Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,7 @@ from scipy.io import wavfile
|
|
| 10 |
import scipy.signal as sps
|
| 11 |
import openai as ai
|
| 12 |
import gc
|
|
|
|
| 13 |
|
| 14 |
checkpoint = "microsoft/speecht5_tts"
|
| 15 |
processor = SpeechT5Processor.from_pretrained(checkpoint)
|
|
@@ -91,8 +92,8 @@ with app:
|
|
| 91 |
|
| 92 |
temp_text=gr.Text(label="Template Text")
|
| 93 |
temp_audio=gr.Audio(label="Template Speech", type="numpy")
|
| 94 |
-
record_audio_prompt = gr.Audio(label='recorded audio prompt', source='microphone', type="numpy")
|
| 95 |
prompt_text=gr.Text(label="Input Text")
|
|
|
|
| 96 |
with gr.Column():
|
| 97 |
text = gr.Textbox(label="Message")
|
| 98 |
speech=gr.Audio(label="Generated Speech", type="numpy")
|
|
@@ -100,5 +101,10 @@ with app:
|
|
| 100 |
btn.click(predict,
|
| 101 |
inputs=[temp_text, temp_audio, record_audio_prompt, prompt_text],
|
| 102 |
outputs=[text, speech])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
app.launch()
|
|
|
|
| 10 |
import scipy.signal as sps
|
| 11 |
import openai as ai
|
| 12 |
import gc
|
| 13 |
+
from examples import *
|
| 14 |
|
| 15 |
checkpoint = "microsoft/speecht5_tts"
|
| 16 |
processor = SpeechT5Processor.from_pretrained(checkpoint)
|
|
|
|
| 92 |
|
| 93 |
temp_text=gr.Text(label="Template Text")
|
| 94 |
temp_audio=gr.Audio(label="Template Speech", type="numpy")
|
|
|
|
| 95 |
prompt_text=gr.Text(label="Input Text")
|
| 96 |
+
record_audio_prompt = gr.Audio(label='recorded audio prompt', source='microphone', type="numpy")
|
| 97 |
with gr.Column():
|
| 98 |
text = gr.Textbox(label="Message")
|
| 99 |
speech=gr.Audio(label="Generated Speech", type="numpy")
|
|
|
|
| 101 |
btn.click(predict,
|
| 102 |
inputs=[temp_text, temp_audio, record_audio_prompt, prompt_text],
|
| 103 |
outputs=[text, speech])
|
| 104 |
+
gr.Examples(examples=infer_from_audio_examples,
|
| 105 |
+
inputs=[temp_text, temp_audio, record_audio_prompt, prompt_text],
|
| 106 |
+
outputs=[text, speech],
|
| 107 |
+
fn=predict,
|
| 108 |
+
cache_examples=False,)
|
| 109 |
|
| 110 |
app.launch()
|