new4u commited on
Commit
8596cb6
1 Parent(s): ed7ad97

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -1,8 +1,12 @@
1
  import torch
2
- # from PIL import Image
3
  import gradio as gr
4
- import yt_dlp as youtube_dl # 用 yt_dlp 代替 pytube
5
  from transformers import pipeline
 
 
 
 
6
 
7
  MODEL_NAME = "openai/whisper-large-v3"
8
  device = 0 if torch.cuda.is_available() else "cpu"
@@ -148,4 +152,4 @@ with demo:
148
  gr.TabbedInterface([mf_transcribe, yt_transcribe], ["转译音频成文字", "YouTube转字幕"])
149
  # Create a gradio interface with no inputs and four outputs
150
  # gr.Interface(display_images, [], [gr.outputs.Image(), gr.outputs.Textbox(), gr.outputs.Image(), gr.outputs.Textbox()], layout="horizontal").launch()
151
- demo.launch(enable_queue=True)
 
1
  import torch
2
+
3
  import gradio as gr
4
+ import yt_dlp as youtube_dl
5
  from transformers import pipeline
6
+ from transformers.pipelines.audio_utils import ffmpeg_read
7
+
8
+ import tempfile
9
+ import os
10
 
11
  MODEL_NAME = "openai/whisper-large-v3"
12
  device = 0 if torch.cuda.is_available() else "cpu"
 
152
  gr.TabbedInterface([mf_transcribe, yt_transcribe], ["转译音频成文字", "YouTube转字幕"])
153
  # Create a gradio interface with no inputs and four outputs
154
  # gr.Interface(display_images, [], [gr.outputs.Image(), gr.outputs.Textbox(), gr.outputs.Image(), gr.outputs.Textbox()], layout="horizontal").launch()
155
+ demo.launch(enable_queue=True)