Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import whisper
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
# Load Whisper Model
|
5 |
+
model = whisper.load_model("small") # Change to "base", "medium", or "large" if needed
|
6 |
+
|
7 |
+
def transcribe(audio):
|
8 |
+
"""Transcribe Speech to Text"""
|
9 |
+
result = model.transcribe(audio)
|
10 |
+
return result["text"]
|
11 |
+
|
12 |
+
# Gradio UI with Microphone
|
13 |
+
gr.Interface(
|
14 |
+
fn=transcribe,
|
15 |
+
inputs=gr.Audio(source="microphone", type="filepath"),
|
16 |
+
outputs="text",
|
17 |
+
title="Whisper Speech-to-Text",
|
18 |
+
description="Speak into the microphone and get text output.",
|
19 |
+
).launch()
|