Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -90,19 +90,16 @@ engine = initialize_engine(DEFAULT_TTS_MODEL_PATH, DEFAULT_AUDIO_TOKENIZER_PATH)
|
|
| 90 |
os.environ["PROCESSED_RESULTS"] = f"{os.getcwd()}/proprocess_results"
|
| 91 |
|
| 92 |
@spaces.GPU
|
| 93 |
-
def tts_from_text(text
|
| 94 |
-
_, output = text_to_speech(engine, text
|
| 95 |
return output
|
| 96 |
|
| 97 |
def speak_to_me(session_id, evt: gr.EventData):
|
| 98 |
detail = getattr(evt, "data", None) or getattr(evt, "_data", {}) or {}
|
| 99 |
|
| 100 |
current_text = detail.get("text", "")
|
| 101 |
-
current_choice = detail.get("choice", "")
|
| 102 |
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
output = tts_from_text(current_text, current_choice)
|
| 106 |
|
| 107 |
if session_id is None:
|
| 108 |
session_id = uuid.uuid4().hex
|
|
@@ -764,7 +761,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 764 |
with gr.Column():
|
| 765 |
|
| 766 |
image_input = gr.Image(label="Reference Image", type="filepath", height=512)
|
| 767 |
-
audio_input = ExtendedAudio(label="Input Audio", type="filepath", options=["
|
| 768 |
|
| 769 |
|
| 770 |
with gr.Column():
|
|
|
|
| 90 |
os.environ["PROCESSED_RESULTS"] = f"{os.getcwd()}/proprocess_results"
|
| 91 |
|
| 92 |
@spaces.GPU
|
| 93 |
+
def tts_from_text(text):
|
| 94 |
+
_, output = text_to_speech(engine, text)
|
| 95 |
return output
|
| 96 |
|
| 97 |
def speak_to_me(session_id, evt: gr.EventData):
|
| 98 |
detail = getattr(evt, "data", None) or getattr(evt, "_data", {}) or {}
|
| 99 |
|
| 100 |
current_text = detail.get("text", "")
|
|
|
|
| 101 |
|
| 102 |
+
output = tts_from_text(current_text)
|
|
|
|
|
|
|
| 103 |
|
| 104 |
if session_id is None:
|
| 105 |
session_id = uuid.uuid4().hex
|
|
|
|
| 761 |
with gr.Column():
|
| 762 |
|
| 763 |
image_input = gr.Image(label="Reference Image", type="filepath", height=512)
|
| 764 |
+
audio_input = ExtendedAudio(label="Input Audio", type="filepath", options=["EMPTY"], show_download_button=True)
|
| 765 |
|
| 766 |
|
| 767 |
with gr.Column():
|