Spaces:
Build error
Build error
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 = 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 | |
block = gr.Blocks() | |
with block: | |
gr.Markdown(markdown) | |
#with gr.Tab('version1'): | |
#with gr.Row(): | |
language = gr.inputs.Textbox(placeholder='Choose your language') | |
text = gr.inputs.Textbox(placeholder='Write your text') | |
record = gr.inputs.Audio(source="microphone",label='Record your voice') | |
save = gr.Button("Save") | |
output = gr.outputs.Textbox(type="auto") | |
save.click(get_record, inputs=[language,text,record],outputs=output) | |
block.launch(enable_queue=True,show_error = True) |