Spaces:
Sleeping
Sleeping
fanaf91318
commited on
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
import torch
|
4 |
+
|
5 |
+
|
6 |
+
# Load the Whisper pipeline
|
7 |
+
pipe = pipeline("automatic-speech-recognition",
|
8 |
+
model="fanaf91318/whisper-large-v3")
|
9 |
+
|
10 |
+
def transcribe_audio(audio_file):
|
11 |
+
# Transcribe the audio
|
12 |
+
result = pipe(audio_file)
|
13 |
+
|
14 |
+
# Return the transcription
|
15 |
+
return result["text"]
|
16 |
+
|
17 |
+
# Create the Gradio interface
|
18 |
+
iface = gr.Interface(
|
19 |
+
fn=transcribe_audio,
|
20 |
+
inputs=gr.Audio(type="filepath"),
|
21 |
+
outputs="text",
|
22 |
+
title="Whisper Large v3 Audio Transcription",
|
23 |
+
description="Upload an audio file to get its transcription using Whisper Large v3."
|
24 |
+
)
|
25 |
+
|
26 |
+
# Launch the interface
|
27 |
+
iface.launch()
|