Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# app.py -
|
| 2 |
# Drop this into your HF Space alongside: avatar.png, avatar.js, style.css
|
| 3 |
# Requirements: gradio, transformers, torch, gtts, pydub, faster-whisper (optional)
|
| 4 |
# Notes: This version uses microphone-only input (gr.Audio sources=["microphone"])
|
|
@@ -199,7 +199,8 @@ def process_interaction(avatar_upload, mic_audio, typed_text, tts_lang):
|
|
| 199 |
tts_gtts_save(reply_text, str(tts_path), lang=tts_lang or "en")
|
| 200 |
|
| 201 |
# Build HTML to show avatar canvas and trigger lip-sync using avatar.js
|
| 202 |
-
|
|
|
|
| 203 |
html = f"""
|
| 204 |
<link rel="stylesheet" href="style.css">
|
| 205 |
<div id="avatar-wrapper">
|
|
@@ -255,7 +256,8 @@ with gr.Blocks(title=title) as demo:
|
|
| 255 |
with gr.Column(scale=1):
|
| 256 |
html_out = gr.HTML(label="Animated avatar (plays reply)")
|
| 257 |
txt_out = gr.Textbox(label="Assistant reply")
|
| 258 |
-
|
|
|
|
| 259 |
|
| 260 |
def on_submit(avatar_upload_, mic_audio_, typed_text_, tts_lang_):
|
| 261 |
return process_interaction(avatar_upload_, mic_audio_, typed_text_, tts_lang_)
|
|
@@ -283,4 +285,3 @@ with gr.Blocks(title=title) as demo:
|
|
| 283 |
|
| 284 |
if __name__ == "__main__":
|
| 285 |
demo.launch()
|
| 286 |
-
|
|
|
|
| 1 |
+
# app.py - Fixed version (Microphone-only input)
|
| 2 |
# Drop this into your HF Space alongside: avatar.png, avatar.js, style.css
|
| 3 |
# Requirements: gradio, transformers, torch, gtts, pydub, faster-whisper (optional)
|
| 4 |
# Notes: This version uses microphone-only input (gr.Audio sources=["microphone"])
|
|
|
|
| 199 |
tts_gtts_save(reply_text, str(tts_path), lang=tts_lang or "en")
|
| 200 |
|
| 201 |
# Build HTML to show avatar canvas and trigger lip-sync using avatar.js
|
| 202 |
+
# Use Gradio-served file path (client will resolve)
|
| 203 |
+
audio_file_url = str(tts_path)
|
| 204 |
html = f"""
|
| 205 |
<link rel="stylesheet" href="style.css">
|
| 206 |
<div id="avatar-wrapper">
|
|
|
|
| 256 |
with gr.Column(scale=1):
|
| 257 |
html_out = gr.HTML(label="Animated avatar (plays reply)")
|
| 258 |
txt_out = gr.Textbox(label="Assistant reply")
|
| 259 |
+
# fixed: use 'filepath' which is a valid Gradio audio output type
|
| 260 |
+
audio_out = gr.Audio(label="Reply audio", type="filepath")
|
| 261 |
|
| 262 |
def on_submit(avatar_upload_, mic_audio_, typed_text_, tts_lang_):
|
| 263 |
return process_interaction(avatar_upload_, mic_audio_, typed_text_, tts_lang_)
|
|
|
|
| 285 |
|
| 286 |
if __name__ == "__main__":
|
| 287 |
demo.launch()
|
|
|