Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -34,7 +34,7 @@ def transcribe(microphone, file_upload, task):
|
|
34 |
|
35 |
file = microphone if microphone is not None else file_upload
|
36 |
|
37 |
-
pipe.model.config.forced_decoder_ids = [[2, transcribe_token_id if task=="
|
38 |
|
39 |
text = pipe(file)["text"]
|
40 |
|
@@ -56,7 +56,7 @@ def yt_transcribe(yt_url, task):
|
|
56 |
stream = yt.streams.filter(only_audio=True)[0]
|
57 |
stream.download(filename="audio.mp3")
|
58 |
|
59 |
-
pipe.model.config.forced_decoder_ids = [[2, transcribe_token_id if task=="
|
60 |
|
61 |
text = pipe("audio.mp3")["text"]
|
62 |
|
@@ -68,9 +68,9 @@ demo = gr.Blocks()
|
|
68 |
mf_transcribe = gr.Interface(
|
69 |
fn=transcribe,
|
70 |
inputs=[
|
71 |
-
gr.inputs.Audio(source="
|
72 |
-
gr.inputs.Audio(source="
|
73 |
-
gr.inputs.Radio(["
|
74 |
],
|
75 |
outputs="text",
|
76 |
layout="horizontal",
|
@@ -78,7 +78,7 @@ mf_transcribe = gr.Interface(
|
|
78 |
title="Sesten Metne Yapay Zeka Destekli Aktarım",
|
79 |
description=(
|
80 |
"Bu hizmet"
|
81 |
-
f"
|
82 |
"tarafından sağlanmaktadır 🤗 "
|
83 |
),
|
84 |
allow_flagging="never",
|
@@ -87,23 +87,23 @@ mf_transcribe = gr.Interface(
|
|
87 |
yt_transcribe = gr.Interface(
|
88 |
fn=yt_transcribe,
|
89 |
inputs=[
|
90 |
-
gr.inputs.Textbox(lines=1, placeholder="
|
91 |
-
gr.inputs.Radio(["
|
92 |
],
|
93 |
outputs=["html", "text"],
|
94 |
layout="horizontal",
|
95 |
theme="huggingface",
|
96 |
title="Videodan Sese Yapay Zeka Destekli Aktarım",
|
97 |
description=(
|
98 |
-
"
|
99 |
-
f"
|
100 |
-
"
|
101 |
),
|
102 |
allow_flagging="never",
|
103 |
)
|
104 |
|
105 |
with demo:
|
106 |
-
gr.TabbedInterface([mf_transcribe, yt_transcribe], ["
|
107 |
|
108 |
demo.launch(enable_queue=True)
|
109 |
|
|
|
34 |
|
35 |
file = microphone if microphone is not None else file_upload
|
36 |
|
37 |
+
pipe.model.config.forced_decoder_ids = [[2, transcribe_token_id if task=="deşifre" else translate_token_id]]
|
38 |
|
39 |
text = pipe(file)["text"]
|
40 |
|
|
|
56 |
stream = yt.streams.filter(only_audio=True)[0]
|
57 |
stream.download(filename="audio.mp3")
|
58 |
|
59 |
+
pipe.model.config.forced_decoder_ids = [[2, transcribe_token_id if task=="deşifre" else translate_token_id]]
|
60 |
|
61 |
text = pipe("audio.mp3")["text"]
|
62 |
|
|
|
68 |
mf_transcribe = gr.Interface(
|
69 |
fn=transcribe,
|
70 |
inputs=[
|
71 |
+
gr.inputs.Audio(source="mikrofon", type="filepath", optional=True),
|
72 |
+
gr.inputs.Audio(source="dosya yükle", type="filepath", optional=True),
|
73 |
+
gr.inputs.Radio(["deşifre", "çeviri"], label="Task", default="deşifre"),
|
74 |
],
|
75 |
outputs="text",
|
76 |
layout="horizontal",
|
|
|
78 |
title="Sesten Metne Yapay Zeka Destekli Aktarım",
|
79 |
description=(
|
80 |
"Bu hizmet"
|
81 |
+
f" [siviltoplum.tech](https://siviltoplum.tech) "
|
82 |
"tarafından sağlanmaktadır 🤗 "
|
83 |
),
|
84 |
allow_flagging="never",
|
|
|
87 |
yt_transcribe = gr.Interface(
|
88 |
fn=yt_transcribe,
|
89 |
inputs=[
|
90 |
+
gr.inputs.Textbox(lines=1, placeholder="YouTube video adresini buraya kopyalayın", label="YouTube Adres"),
|
91 |
+
gr.inputs.Radio(["deşifre", "çeviri"], label="Task", default="deşifre")
|
92 |
],
|
93 |
outputs=["html", "text"],
|
94 |
layout="horizontal",
|
95 |
theme="huggingface",
|
96 |
title="Videodan Sese Yapay Zeka Destekli Aktarım",
|
97 |
description=(
|
98 |
+
"Bu hizmet"
|
99 |
+
f" [siviltoplum.tech](https://siviltoplum.tech) "
|
100 |
+
"tarafından sağlanmaktadır 🤗 "
|
101 |
),
|
102 |
allow_flagging="never",
|
103 |
)
|
104 |
|
105 |
with demo:
|
106 |
+
gr.TabbedInterface([mf_transcribe, yt_transcribe], ["Ses Deşifre Et", "YouTube Videosu Deşifre Et"])
|
107 |
|
108 |
demo.launch(enable_queue=True)
|
109 |
|