Spaces:
Runtime error
Runtime error
Commit
·
792ee14
1
Parent(s):
c9caa1d
Update app.py
Browse files
app.py
CHANGED
@@ -32,25 +32,6 @@ def transcribe(microphone, file_upload):
|
|
32 |
return warn_output + text
|
33 |
|
34 |
|
35 |
-
# def _return_yt_html_embed(yt_url):
|
36 |
-
# video_id = yt_url.split("?v=")[-1]
|
37 |
-
# HTML_str = (
|
38 |
-
# f'<center> <iframe width="500" height="320" src="https://www.youtube.com/embed/{video_id}"> </iframe>'
|
39 |
-
# " </center>"
|
40 |
-
# )
|
41 |
-
# return HTML_str
|
42 |
-
|
43 |
-
|
44 |
-
# def yt_transcribe(yt_url):
|
45 |
-
# yt = pt.YouTube(yt_url)
|
46 |
-
# html_embed_str = _return_yt_html_embed(yt_url)
|
47 |
-
# stream = yt.streams.filter(only_audio=True)[0]
|
48 |
-
# stream.download(filename="audio.mp3")
|
49 |
-
|
50 |
-
# text = pipe("audio.mp3")["text"]
|
51 |
-
|
52 |
-
# return html_embed_str, text
|
53 |
-
|
54 |
def rt_transcribe(audio, state=""):
|
55 |
time.sleep(2)
|
56 |
text = p(audio)["text"]
|
@@ -60,7 +41,7 @@ def rt_transcribe(audio, state=""):
|
|
60 |
|
61 |
demo = gr.Blocks()
|
62 |
|
63 |
-
examples=[["examples/example1.mp3"], ["examples/example2.mp3"]]
|
64 |
|
65 |
description = """
|
66 |
<p>
|
@@ -69,10 +50,14 @@ Welcome to the HindiSpeechPro, a cutting-edge interface powered by a fine-tuned
|
|
69 |
</center>
|
70 |
</p>
|
71 |
<center>
|
72 |
-
<img src="https://huggingface.co/spaces/
|
73 |
</center>
|
74 |
"""
|
75 |
|
|
|
|
|
|
|
|
|
76 |
mf_transcribe = gr.Interface(
|
77 |
fn=transcribe,
|
78 |
inputs=[
|
@@ -85,7 +70,26 @@ mf_transcribe = gr.Interface(
|
|
85 |
description= description ,
|
86 |
allow_flagging="never",
|
87 |
examples=examples,
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
|
|
|
|
|
90 |
|
91 |
-
|
|
|
32 |
return warn_output + text
|
33 |
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
def rt_transcribe(audio, state=""):
|
36 |
time.sleep(2)
|
37 |
text = p(audio)["text"]
|
|
|
41 |
|
42 |
demo = gr.Blocks()
|
43 |
|
44 |
+
examples=[["examples/example1.mp3"], ["examples/example2.mp3"],["examples/example3.mp3"]]
|
45 |
|
46 |
description = """
|
47 |
<p>
|
|
|
50 |
</center>
|
51 |
</p>
|
52 |
<center>
|
53 |
+
<img src="https://huggingface.co/spaces/SakshiRathi77/SakshiRathi77-Wav2Vec2-hi-kagglex/blob/main/Images/Hindi-Speech-Voice-Recognition-Tool.jpg" alt="logo" width="550"/>
|
54 |
</center>
|
55 |
"""
|
56 |
|
57 |
+
|
58 |
+
css='div {margin-left: auto; margin-right: auto; width: 100%;\
|
59 |
+
background-image: url("https://huggingface.co/spaces/SakshiRathi77/SakshiRathi77-Wav2Vec2-hi-kagglex/blob/main/Images/image-bg.jpg"); repeat 0 0;}')
|
60 |
+
|
61 |
mf_transcribe = gr.Interface(
|
62 |
fn=transcribe,
|
63 |
inputs=[
|
|
|
70 |
description= description ,
|
71 |
allow_flagging="never",
|
72 |
examples=examples,
|
73 |
+
css=css,
|
74 |
+
)
|
75 |
+
|
76 |
+
rt_transcribe = gr.Interface(
|
77 |
+
fn=rt_transcribe,
|
78 |
+
inputs=[
|
79 |
+
gr.Audio(source="microphone", type="filepath", streaming=True),
|
80 |
+
"state"
|
81 |
+
],
|
82 |
+
outputs=[ "textbox",
|
83 |
+
"state"],
|
84 |
+
theme='EveryPizza/Cartoony-Gradio-Theme',
|
85 |
+
title="HindiSpeechPro: WAV2VEC-Powered ASR Interface",
|
86 |
+
description= description ,
|
87 |
+
allow_flagging="never",
|
88 |
+
live=True
|
89 |
+
)
|
90 |
+
|
91 |
|
92 |
+
with demo:
|
93 |
+
gr.TabbedInterface([mf_transcribe, rt_transcribe], ["Transcribe Audio", "Transcribe Realtime Voice"])
|
94 |
|
95 |
+
demo.launch(share=True)
|