elina12 commited on
Commit
da66b5c
·
1 Parent(s): 5f76b74

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -39
app.py CHANGED
@@ -1,41 +1,3 @@
1
- # from transformers import pipeline
2
- # import gradio as gr
3
-
4
-
5
- # # Load the pipeline with the cache_dir parameter
6
- # pipe = pipeline(model="tarteel-ai/whisper-base-ar-quran")
7
-
8
- # def transcribe(audio):
9
- # text = pipe(audio)["text"]
10
- # return text
11
-
12
- # iface = gr.Interface(
13
- # fn=transcribe,
14
- # inputs=gr.Audio(source="upload", type="filepath"),
15
- # outputs="text",
16
- # )
17
-
18
- # iface.launch()
19
- from transformers import pipeline
20
-
21
- model_id = "tarteel-ai/whisper-base-ar-quran" # update with your model id
22
- pipe = pipeline("automatic-speech-recognition", model=model_id)
23
-
24
- def transcribe(filepath):
25
- output = pipe(
26
- filepath,
27
- max_new_tokens=10000,
28
- chunk_length_s=30,
29
- batch_size=8,
30
- )
31
- return output["text"]
32
-
33
  import gradio as gr
34
 
35
- iface = gr.Interface(
36
- fn=transcribe,
37
- inputs=gr.Audio(source="upload", type="filepath"),
38
- outputs="text",
39
- )
40
-
41
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ gr.Interface.load("models/tarteel-ai/whisper-base-ar-quran").launch()