afro-speech / app3.py
chrisjay's picture
added ffmpeg to packages.txt
fb86baf
import os
import gradio as gr
#HF_TOKEN = os.environ.get("HF_TOKEN")
#print("is none?", HF_TOKEN is None)
def get_record(language,text,record):
# Save text and its corresponding record to flag
text =text.strip()
#output_string = "<html> <body> <div class='output'>"+f'Record for text {text} successfully saved to dataset! Thank You.'+"</div> </body> </html>"
output_string = f'Record for text - {text} - successfully saved to dataset! Thank You.'
return output_string
title = 'African Crowdsource Speech'
description = 'A platform to contribute to your African language by recording your voice'
markdown = """# African Crowdsource Speech
A platform to contribute to your African language by recording your voice
"""
# Get a dropdown of all African languages
# Interface design begins
#import pdb; pdb.set_trace()
iface = gr.Interface(fn=get_record,
inputs=[gr.inputs.Textbox(placeholder='Choose your language'),
gr.inputs.Textbox(placeholder='Write your text'),
gr.inputs.Audio(source="microphone",label='Record your voice')
],
outputs = "text",
title=title,
description=description,
theme='huggingface'
)
iface.launch()