Spaces:
No application file
No application file
Delete app.py
Browse files
app.py
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
# 測試語音轉文字
|
2 |
-
from whisper import load_model
|
3 |
-
from whisper.transcribe import transcribe
|
4 |
-
|
5 |
-
model = load_model("whisper_large")
|
6 |
-
|
7 |
-
def transcribe_audio(audio_file):
|
8 |
-
with open(audio_file, "rb") as f:
|
9 |
-
audio_data = f.read()
|
10 |
-
|
11 |
-
transcription = transcribe(model, audio_data)
|
12 |
-
|
13 |
-
return transcription
|
14 |
-
|
15 |
-
def transcribe_microphone():
|
16 |
-
transcription = transcribe(model, None)
|
17 |
-
|
18 |
-
return transcription
|
19 |
-
|
20 |
-
def transcribe_youtube_video(youtube_url):
|
21 |
-
transcription = transcribe(model, youtube_url)
|
22 |
-
|
23 |
-
return transcription
|
24 |
-
|
25 |
-
app = gradio.Interface(fn=[transcribe_audio, transcribe_microphone, transcribe_youtube_video], inputs=["Audio File", "Microphone", "YouTube Video URL"], outputs=["Transcription"])
|
26 |
-
launch(app)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|