elina12 commited on
Commit
c4de0bc
1 Parent(s): da66b5c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -1,3 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
- gr.Interface.load("models/tarteel-ai/whisper-base-ar-quran").launch()
 
 
 
 
 
 
 
1
+ # import gradio as gr
2
+
3
+ # gr.Interface.load("models/tarteel-ai/whisper-base-ar-quran").launch()
4
+ from transformers import pipeline
5
+
6
+ model_id = "tarteel-ai/whisper-base-ar-quran"
7
+ pipe = pipeline("automatic-speech-recognition", model=model_id)
8
+
9
+ def transcribe(filepath):
10
+ output = pipe(
11
+ filepath
12
+ )
13
+ return output["text"]
14
+
15
  import gradio as gr
16
 
17
+ iface = gr.Interface(
18
+ fn=transcribe,
19
+ inputs=gr.Audio(source="upload", type="filepath"),
20
+ outputs="text",
21
+ )
22
+
23
+ iface.launch()