Spaces:
Running
Running
jonathanagustin
commited on
Commit
•
614dae3
1
Parent(s):
6385f1b
Upload folder using huggingface_hub
Browse files- app.py +7 -8
- requirements.txt +1 -0
app.py
CHANGED
@@ -82,11 +82,9 @@ def main():
|
|
82 |
print(f"Failed to download {voice} preview: {e}")
|
83 |
VOICE_PREVIEW_FILES[voice] = local_file_path
|
84 |
|
85 |
-
#
|
86 |
-
|
87 |
-
|
88 |
-
for voice, path in VOICE_PREVIEW_FILES.items()
|
89 |
-
}
|
90 |
|
91 |
with gr.Blocks() as demo:
|
92 |
# Include global CSS styles for the audio elements
|
@@ -146,7 +144,8 @@ def main():
|
|
146 |
# Add voice previews using HTML for minimal audio interface
|
147 |
gr.Markdown("### Voice Previews")
|
148 |
for voice in VOICE_OPTIONS:
|
149 |
-
|
|
|
150 |
# Create an HTML audio player with minimal controls
|
151 |
html_snippet = f'''
|
152 |
<div style="margin-bottom: 10px;">
|
@@ -181,8 +180,8 @@ def main():
|
|
181 |
outputs=output_audio,
|
182 |
)
|
183 |
|
184 |
-
# Launch the Gradio app with error display enabled
|
185 |
-
demo.launch(show_error=True
|
186 |
|
187 |
|
188 |
if __name__ == "__main__":
|
|
|
82 |
print(f"Failed to download {voice} preview: {e}")
|
83 |
VOICE_PREVIEW_FILES[voice] = local_file_path
|
84 |
|
85 |
+
# Set static paths for Gradio to serve
|
86 |
+
# This needs to be done before creating the Gradio app
|
87 |
+
gr.set_static_paths([PREVIEW_DIR])
|
|
|
|
|
88 |
|
89 |
with gr.Blocks() as demo:
|
90 |
# Include global CSS styles for the audio elements
|
|
|
144 |
# Add voice previews using HTML for minimal audio interface
|
145 |
gr.Markdown("### Voice Previews")
|
146 |
for voice in VOICE_OPTIONS:
|
147 |
+
# Use the relative path for the audio file
|
148 |
+
audio_url = f"file/{PREVIEW_DIR}/{voice}.wav"
|
149 |
# Create an HTML audio player with minimal controls
|
150 |
html_snippet = f'''
|
151 |
<div style="margin-bottom: 10px;">
|
|
|
180 |
outputs=output_audio,
|
181 |
)
|
182 |
|
183 |
+
# Launch the Gradio app with error display enabled
|
184 |
+
demo.launch(show_error=True)
|
185 |
|
186 |
|
187 |
if __name__ == "__main__":
|
requirements.txt
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
gradio[oauth]==4.44.0
|
2 |
openai==1.47.0
|
|
|
3 |
spaces==0.30.2
|
4 |
uvicorn==0.30.6
|
|
|
1 |
gradio[oauth]==4.44.0
|
2 |
openai==1.47.0
|
3 |
+
requests=2.31.0
|
4 |
spaces==0.30.2
|
5 |
uvicorn==0.30.6
|