sheikhed commited on
Commit
171521f
·
verified ·
1 Parent(s): e3029ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -10
app.py CHANGED
@@ -172,12 +172,6 @@ def create_interface():
172
  voices = await get_voices()
173
  return [v[1] for v in voices]
174
 
175
- async def on_generate(voice, video_url, text):
176
- if not voice:
177
- return None, "Invalid voice selected."
178
- voice_id = next(v[0] for v in await get_voices() if v[1] == voice)
179
- return await process_video(voice_id, video_url, text)
180
-
181
  with gr.Blocks() as app:
182
  gr.Markdown("# JSON Train")
183
  with gr.Row():
@@ -186,14 +180,19 @@ def create_interface():
186
  video_url_input = gr.Textbox(label="Enter Video URL")
187
  text_input = gr.Textbox(label="Enter text", lines=3)
188
  generate_btn = gr.Button("Generate Video")
189
- output = gr.Textbox(label="Output")
190
-
 
 
 
 
 
191
  generate_btn.click(
192
  fn=on_generate,
193
  inputs=[voice_dropdown, video_url_input, text_input],
194
- outputs=[output]
195
  )
196
-
197
  return app
198
 
199
  if __name__ == "__main__":
 
172
  voices = await get_voices()
173
  return [v[1] for v in voices]
174
 
 
 
 
 
 
 
175
  with gr.Blocks() as app:
176
  gr.Markdown("# JSON Train")
177
  with gr.Row():
 
180
  video_url_input = gr.Textbox(label="Enter Video URL")
181
  text_input = gr.Textbox(label="Enter text", lines=3)
182
  generate_btn = gr.Button("Generate Video")
183
+ with gr.Column():
184
+ video_output = gr.Video(label="Generated Video")
185
+ status_output = gr.Textbox(label="Status", interactive=False)
186
+
187
+ async def on_generate(voice_name, video_url, text):
188
+ return await process_video(voice_name, video_url, text)
189
+
190
  generate_btn.click(
191
  fn=on_generate,
192
  inputs=[voice_dropdown, video_url_input, text_input],
193
+ outputs=[video_output, status_output]
194
  )
195
+
196
  return app
197
 
198
  if __name__ == "__main__":