Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
import spaces
|
4 |
+
|
5 |
+
# Load the Whisper model from Hugging Face
|
6 |
+
model = pipeline("automatic-speech-recognition", model="ylacombe/whisper-large-v3-turbo")
|
7 |
+
|
8 |
+
# Function to process audio input and transcribe it
|
9 |
+
@spaces.GPU
|
10 |
+
def transcribe(audio):
|
11 |
+
# Load and preprocess the audio
|
12 |
+
transcription = model(audio)["text"]
|
13 |
+
return transcription
|
14 |
+
|
15 |
+
# Gradio interface
|
16 |
+
interface = gr.Interface(
|
17 |
+
fn=transcribe,
|
18 |
+
inputs=gr.Audio(source="microphone", type="filepath"),
|
19 |
+
outputs="text",
|
20 |
+
title="Whisper Voice Transcription with Hugging Face"
|
21 |
+
)
|
22 |
+
|
23 |
+
# Launch the app
|
24 |
+
interface.launch()
|