stardate69 commited on
Commit
aa17bad
·
verified ·
1 Parent(s): e385a06

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -37,19 +37,17 @@ def generate_audio(prompt: str):
37
  output_path = os.path.join(OUTPUT_PATH, output_filename)
38
  sf.write(output_path, output_audio, pipe.vae.sampling_rate)
39
 
40
- # Construct full URL to access the generated file
41
- audio_url = f"https://huggingface.co/spaces/stardate69/StableAudioOpenEndpoint/audio/{output_filename}"
42
-
43
- return audio_url
44
 
45
  # Gradio Interface setup
46
  interface = gr.Interface(
47
- fn=generate_audio,
48
  inputs=gr.Textbox(label="Enter a text prompt to generate audio"),
49
- outputs=gr.Textbox(label="Generated Audio URL"),
50
- title="StableAudioText2Audio",
51
  description="Generate audio from a text prompt using Hugging Face StableAudio Pipeline."
52
  )
53
 
54
- # Launch the Gradio interface as an HTTP endpoint
55
  interface.launch(share=True)
 
37
  output_path = os.path.join(OUTPUT_PATH, output_filename)
38
  sf.write(output_path, output_audio, pipe.vae.sampling_rate)
39
 
40
+ # Return the file path so Gradio serves the file
41
+ return output_path
 
 
42
 
43
  # Gradio Interface setup
44
  interface = gr.Interface(
45
+ fn=generate_audio,
46
  inputs=gr.Textbox(label="Enter a text prompt to generate audio"),
47
+ outputs=gr.File(label="Generated Audio File"),
48
+ title="StableAudioText2Speech",
49
  description="Generate audio from a text prompt using Hugging Face StableAudio Pipeline."
50
  )
51
 
52
+ # Launch the Gradio interface
53
  interface.launch(share=True)