Bils commited on
Commit
e96c552
·
verified ·
1 Parent(s): 39f48a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -24,7 +24,6 @@ hf_token = os.getenv("HF_TOKEN")
24
  # Script Generation Function
25
  # ---------------------------------------------------------------------
26
  @spaces.GPU(duration=300)
27
- @spaces.GPU(duration=300)
28
  def generate_script(user_prompt: str, model_id: str, token: str, duration: int):
29
  try:
30
  tokenizer = AutoTokenizer.from_pretrained(model_id, use_auth_token=token)
@@ -145,12 +144,13 @@ with gr.Blocks() as demo:
145
 
146
  generate_script_button = gr.Button("Generate Script")
147
  script_output = gr.Textbox(label="Generated Script")
 
148
  music_suggestion_output = gr.Textbox(label="Music Suggestion")
149
 
150
  generate_script_button.click(
151
- fn=lambda user_prompt, model_id, duration: generate_script(user_prompt, model_id, hf_token, duration),
152
- inputs=[user_prompt, llama_model_id, duration],
153
- outputs=[script_output, music_suggestion_output],
154
  )
155
 
156
  with gr.Tab("Step 2: Generate Voice"):
@@ -161,7 +161,7 @@ with gr.Blocks() as demo:
161
  voice_output = gr.Audio(label="Generated Voice", type="filepath")
162
 
163
  generate_voice_button.click(
164
- fn=lambda script, speaker: generate_voice(script, speaker),
165
  inputs=[script_output, speaker],
166
  outputs=[voice_output],
167
  )
@@ -174,7 +174,7 @@ with gr.Blocks() as demo:
174
  music_output = gr.Audio(label="Generated Music", type="filepath")
175
 
176
  generate_music_button.click(
177
- fn=lambda music_suggestion, audio_length: generate_music(music_suggestion, audio_length),
178
  inputs=[music_suggestion_output, audio_length],
179
  outputs=[music_output],
180
  )
@@ -187,7 +187,7 @@ with gr.Blocks() as demo:
187
  final_output = gr.Audio(label="Final Promo Audio", type="filepath")
188
 
189
  blend_button.click(
190
- fn=lambda voice_path, music_path, ducking: blend_audio(voice_path, music_path, ducking),
191
  inputs=[voice_output, music_output, ducking],
192
  outputs=[final_output],
193
  )
@@ -199,4 +199,4 @@ with gr.Blocks() as demo:
199
  </p>
200
  """)
201
 
202
- demo.launch(debug=True)
 
24
  # Script Generation Function
25
  # ---------------------------------------------------------------------
26
  @spaces.GPU(duration=300)
 
27
  def generate_script(user_prompt: str, model_id: str, token: str, duration: int):
28
  try:
29
  tokenizer = AutoTokenizer.from_pretrained(model_id, use_auth_token=token)
 
144
 
145
  generate_script_button = gr.Button("Generate Script")
146
  script_output = gr.Textbox(label="Generated Script")
147
+ sound_design_output = gr.Textbox(label="Sound Design")
148
  music_suggestion_output = gr.Textbox(label="Music Suggestion")
149
 
150
  generate_script_button.click(
151
+ fn=generate_script,
152
+ inputs=[user_prompt, llama_model_id, hf_token, duration],
153
+ outputs=[script_output, sound_design_output, music_suggestion_output],
154
  )
155
 
156
  with gr.Tab("Step 2: Generate Voice"):
 
161
  voice_output = gr.Audio(label="Generated Voice", type="filepath")
162
 
163
  generate_voice_button.click(
164
+ fn=generate_voice,
165
  inputs=[script_output, speaker],
166
  outputs=[voice_output],
167
  )
 
174
  music_output = gr.Audio(label="Generated Music", type="filepath")
175
 
176
  generate_music_button.click(
177
+ fn=generate_music,
178
  inputs=[music_suggestion_output, audio_length],
179
  outputs=[music_output],
180
  )
 
187
  final_output = gr.Audio(label="Final Promo Audio", type="filepath")
188
 
189
  blend_button.click(
190
+ fn=blend_audio,
191
  inputs=[voice_output, music_output, ducking],
192
  outputs=[final_output],
193
  )
 
199
  </p>
200
  """)
201
 
202
+ demo.launch(debug=True)