Spaces:
Build error
Build error
added ffmpeg to packages.txt
Browse files- app.py +19 -18
- app2.py +0 -0
- app3.py +39 -0
- packages.txt +1 -0
- requirements.txt +0 -1
app.py
CHANGED
|
@@ -9,31 +9,32 @@ def get_record(language,text,record):
|
|
| 9 |
# Save text and its corresponding record to flag
|
| 10 |
|
| 11 |
text =text.strip()
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
output_string = 'Record for text successfully saved to dataset! Thank You.'
|
| 15 |
return output_string
|
| 16 |
|
| 17 |
title = 'African Crowdsource Speech'
|
| 18 |
description = 'A platform to contribute to your African language by recording your voice'
|
| 19 |
|
| 20 |
-
markdown = """
|
| 21 |
-
|
| 22 |
-
A platform to contribute to your African language by recording your voice
|
| 23 |
-
"""
|
| 24 |
|
| 25 |
# Get a dropdown of all African languages
|
| 26 |
|
| 27 |
# Interface design begins
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
inputs=[gr.inputs.Textbox(placeholder='Choose your language'),
|
| 31 |
-
gr.inputs.Textbox(placeholder='Write your text'),
|
| 32 |
-
gr.inputs.Audio(source="microphone",label='Record your voice')
|
| 33 |
-
],
|
| 34 |
-
outputs = "text",
|
| 35 |
-
title=title,
|
| 36 |
-
description=description,
|
| 37 |
-
theme='huggingface'
|
| 38 |
-
)
|
| 39 |
-
iface.launch()
|
|
|
|
| 9 |
# Save text and its corresponding record to flag
|
| 10 |
|
| 11 |
text =text.strip()
|
| 12 |
+
output_string = "<html> <body> <div class='output' style='color:green; font-size:13px'>"+f'Recording for text <i>{text}</i> successfully saved to dataset! Thank You.'+"</div> </body> </html>"
|
| 13 |
+
|
|
|
|
| 14 |
return output_string
|
| 15 |
|
| 16 |
title = 'African Crowdsource Speech'
|
| 17 |
description = 'A platform to contribute to your African language by recording your voice'
|
| 18 |
|
| 19 |
+
markdown = """African Crowdsource Speech: a platform to contribute to your African language by recording your voice"""
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
# Get a dropdown of all African languages
|
| 22 |
|
| 23 |
# Interface design begins
|
| 24 |
+
block = gr.Blocks()
|
| 25 |
+
with block:
|
| 26 |
+
gr.Markdown(markdown)
|
| 27 |
+
|
| 28 |
+
#with gr.Tab('version1'):
|
| 29 |
+
#with gr.Row():
|
| 30 |
+
language = gr.inputs.Textbox(placeholder='Choose your language')
|
| 31 |
+
text = gr.inputs.Textbox(placeholder='Write your text')
|
| 32 |
+
record = gr.inputs.Audio(source="microphone",label='Record your voice')
|
| 33 |
+
output_result = gr.outputs.HTML()
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
save = gr.Button("Save")
|
| 37 |
+
|
| 38 |
+
save.click(get_record, inputs=[language,text,record],outputs=output_result)
|
| 39 |
|
| 40 |
+
block.launch(enable_queue=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app2.py
DELETED
|
File without changes
|
app3.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
#HF_TOKEN = os.environ.get("HF_TOKEN")
|
| 6 |
+
#print("is none?", HF_TOKEN is None)
|
| 7 |
+
|
| 8 |
+
def get_record(language,text,record):
|
| 9 |
+
# Save text and its corresponding record to flag
|
| 10 |
+
|
| 11 |
+
text =text.strip()
|
| 12 |
+
|
| 13 |
+
#output_string = "<html> <body> <div class='output'>"+f'Record for text {text} successfully saved to dataset! Thank You.'+"</div> </body> </html>"
|
| 14 |
+
output_string = f'Record for text - {text} - successfully saved to dataset! Thank You.'
|
| 15 |
+
return output_string
|
| 16 |
+
|
| 17 |
+
title = 'African Crowdsource Speech'
|
| 18 |
+
description = 'A platform to contribute to your African language by recording your voice'
|
| 19 |
+
|
| 20 |
+
markdown = """# African Crowdsource Speech
|
| 21 |
+
|
| 22 |
+
A platform to contribute to your African language by recording your voice
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
# Get a dropdown of all African languages
|
| 26 |
+
|
| 27 |
+
# Interface design begins
|
| 28 |
+
#import pdb; pdb.set_trace()
|
| 29 |
+
iface = gr.Interface(fn=get_record,
|
| 30 |
+
inputs=[gr.inputs.Textbox(placeholder='Choose your language'),
|
| 31 |
+
gr.inputs.Textbox(placeholder='Write your text'),
|
| 32 |
+
gr.inputs.Audio(source="microphone",label='Record your voice')
|
| 33 |
+
],
|
| 34 |
+
outputs = "text",
|
| 35 |
+
title=title,
|
| 36 |
+
description=description,
|
| 37 |
+
theme='huggingface'
|
| 38 |
+
)
|
| 39 |
+
iface.launch()
|
packages.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
ffmpeg
|
requirements.txt
CHANGED
|
@@ -1 +0,0 @@
|
|
| 1 |
-
ffprobe3
|
|
|
|
|
|