jpjp9292 commited on
Commit
38e25e4
β€’
1 Parent(s): 50c4728

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -40,12 +40,12 @@ def transcribe_audio(model_size, audio_file):
40
 
41
  # Gradio μΈν„°νŽ˜μ΄μŠ€μ—μ„œ μ‚¬μš©ν•  메인 ν•¨μˆ˜
42
  def process_video(model_size, video_file=None, video_url=None):
43
- if video_url:
44
  video_file_path = gr.processing_utils.download_url(video_url, dir='/tmp')
45
- elif video_file:
46
  video_file_path = video_file.name
47
  else:
48
- return "Please upload a video file or provide a video URL."
49
 
50
  save_path = "/tmp"
51
  mp3_file_path = convert_mp4_to_mp3(video_file_path, save_path)
@@ -57,12 +57,13 @@ iface = gr.Interface(
57
  fn=process_video,
58
  inputs=[
59
  gr.Dropdown(["tiny", "base", "small", "medium", "large"], label="Model Size"),
60
- gr.File(label="Upload Video File", optional=True),
61
- gr.Textbox(label="Video URL", optional=True)
62
  ],
63
  outputs="text",
64
  title="Video to Text Converter using Whisper",
65
- description="Upload a video file or provide a video URL, select the Whisper model size, and get the transcribed text."
 
66
  )
67
 
68
  if __name__ == "__main__":
 
40
 
41
  # Gradio μΈν„°νŽ˜μ΄μŠ€μ—μ„œ μ‚¬μš©ν•  메인 ν•¨μˆ˜
42
  def process_video(model_size, video_file=None, video_url=None):
43
+ if video_url and not video_file:
44
  video_file_path = gr.processing_utils.download_url(video_url, dir='/tmp')
45
+ elif video_file and not video_url:
46
  video_file_path = video_file.name
47
  else:
48
+ return "Please upload a video file or provide a video URL, but not both."
49
 
50
  save_path = "/tmp"
51
  mp3_file_path = convert_mp4_to_mp3(video_file_path, save_path)
 
57
  fn=process_video,
58
  inputs=[
59
  gr.Dropdown(["tiny", "base", "small", "medium", "large"], label="Model Size"),
60
+ gr.File(label="Upload Video File"),
61
+ gr.Textbox(label="Video URL")
62
  ],
63
  outputs="text",
64
  title="Video to Text Converter using Whisper",
65
+ description="Upload a video file or provide a video URL, select the Whisper model size, and get the transcribed text.",
66
+ live=True
67
  )
68
 
69
  if __name__ == "__main__":