baaabaei commited on
Commit
c7d25dd
·
verified ·
1 Parent(s): c66dfbb

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +24 -0
  2. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ # Load model
5
+ pipe = pipeline(
6
+ "automatic-speech-recognition",
7
+ model="baaabaei/whisper-small-fa"
8
+ )
9
+
10
+ def transcribe(audio):
11
+ text = pipe(audio)["text"]
12
+ return text
13
+
14
+ # Create Gradio interface
15
+ interface = gr.Interface(
16
+ fn=transcribe,
17
+ inputs=gr.Audio(sources=["microphone"], type="filepath"),
18
+ outputs="text",
19
+ title="Persian Speech Recognition",
20
+ description="Real-time Persian speech-to-text using fine-tuned Whisper-small",
21
+ examples=[["path_to_sample_audio.wav"]] # Add sample audio if available
22
+ )
23
+
24
+ interface.launch()
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ torch
2
+ transformers
3
+ gradio
4
+ datasets