artificialguybr commited on
Commit
12ce031
1 Parent(s): eadabd0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -232,11 +232,11 @@ def process_video(radio, video, target_language, has_closeup_face):
232
  except FileNotFoundError:
233
  print(f"File {file} not found for deletion.")
234
 
235
- return output_video_path
236
 
237
  except Exception as e:
238
  print(f"Error in process_video: {str(e)}")
239
- return gr.update(value=None, visible=True), f"Error: {str(e)}"
240
 
241
  def swap(radio):
242
  if(radio == "Upload"):
@@ -257,7 +257,10 @@ iface = gr.Interface(
257
  value=False,
258
  info="Say if video have close-up face. For Wav2lip. Will not work if checked wrongly.")
259
  ],
260
- outputs=[gr.Video(), gr.Textbox(label="Error Message")],
 
 
 
261
  live=False,
262
  title="AI Video Dubbing",
263
  description="""This tool was developed by [@artificialguybr](https://twitter.com/artificialguybr) using entirely open-source tools. Special thanks to Hugging Face for the GPU support. Thanks [@yeswondwer](https://twitter.com/@yeswondwerr) for original code. Test the [Video Transcription and Translate](https://huggingface.co/spaces/artificialguybr/VIDEO-TRANSLATION-TRANSCRIPTION) space!""",
@@ -279,4 +282,4 @@ with gr.Blocks() as demo:
279
 
280
  print("Launching Gradio interface...")
281
  demo.queue()
282
- demo.launch()
 
232
  except FileNotFoundError:
233
  print(f"File {file} not found for deletion.")
234
 
235
+ return output_video_path, "" # Retorna o caminho do vídeo e uma string vazia para a mensagem de erro
236
 
237
  except Exception as e:
238
  print(f"Error in process_video: {str(e)}")
239
+ return None, f"Error: {str(e)}" # Retorna None para o vídeo e a mensagem de erro
240
 
241
  def swap(radio):
242
  if(radio == "Upload"):
 
257
  value=False,
258
  info="Say if video have close-up face. For Wav2lip. Will not work if checked wrongly.")
259
  ],
260
+ outputs=[
261
+ gr.Video(label="Processed Video"),
262
+ gr.Textbox(label="Error Message")
263
+ ],
264
  live=False,
265
  title="AI Video Dubbing",
266
  description="""This tool was developed by [@artificialguybr](https://twitter.com/artificialguybr) using entirely open-source tools. Special thanks to Hugging Face for the GPU support. Thanks [@yeswondwer](https://twitter.com/@yeswondwerr) for original code. Test the [Video Transcription and Translate](https://huggingface.co/spaces/artificialguybr/VIDEO-TRANSLATION-TRANSCRIPTION) space!""",
 
282
 
283
  print("Launching Gradio interface...")
284
  demo.queue()
285
+ demo.launch()