JohnsonManuel
commited on
Commit
•
a088775
1
Parent(s):
554a04b
Pushing to Higging Face - Initial commit
Browse files- app.py +26 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import whisper
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
|
5 |
+
model = whisper.load_model('base')
|
6 |
+
|
7 |
+
|
8 |
+
def transcribe(inputs, task):
|
9 |
+
if inputs is None:
|
10 |
+
raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
|
11 |
+
|
12 |
+
result = model.transcribe(inputs)
|
13 |
+
return result["text"]
|
14 |
+
|
15 |
+
|
16 |
+
interface = gr.Interface(
|
17 |
+
fn=transcribe,
|
18 |
+
inputs=gr.Audio(sources=["microphone"],type="filepath"),
|
19 |
+
outputs="text",
|
20 |
+
title="Whisper Large V3: Transcribe Audio",
|
21 |
+
description=(
|
22 |
+
"Transcribe long-form microphone or audio inputs with the click of a button! Demo uses the OpenAI Whisper"
|
23 |
+
)
|
24 |
+
)
|
25 |
+
|
26 |
+
interface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
gradio==4.36.1
|
2 |
+
openai-whisper==20231117
|
3 |
+
numpy
|