Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from transformers import pipeline
|
2 |
-
import gradio as gr
|
3 |
|
|
|
|
|
4 |
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
-
|
9 |
-
text = pipe(audio)["text"]
|
10 |
-
return text
|
11 |
|
12 |
iface = gr.Interface(
|
13 |
fn=transcribe,
|
|
|
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_speech(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,
|