Spaces:
Runtime error
Runtime error
Commit
·
a592895
1
Parent(s):
ca99446
input Audio change
Browse files
app.py
CHANGED
@@ -107,7 +107,7 @@ def yt_transcribe(yt_url, task, return_timestamps, language, max_filesize=75.0):
|
|
107 |
inputs = {"array": inputs, "sampling_rate": pipe.feature_extractor.sampling_rate}
|
108 |
|
109 |
# Map the language names to their corresponding codes
|
110 |
-
language_codes = {"English": "en", "Uzbek":
|
111 |
language_code = language_codes.get(language, "en") # Default to "en" if the language is not found
|
112 |
|
113 |
result = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task, "language": f"<|{language_code}|>"},
|
@@ -124,10 +124,10 @@ demo = gr.Blocks()
|
|
124 |
mf_transcribe = gr.Interface(
|
125 |
fn=transcribe,
|
126 |
inputs=[
|
127 |
-
gr.
|
128 |
gr.inputs.Radio(["transcribe", "translate"], label="Task", default="transcribe"),
|
129 |
gr.inputs.Checkbox(label="Return timestamps"),
|
130 |
-
|
131 |
],
|
132 |
outputs="text",
|
133 |
layout="horizontal",
|
@@ -143,10 +143,10 @@ mf_transcribe = gr.Interface(
|
|
143 |
file_transcribe = gr.Interface(
|
144 |
fn=transcribe,
|
145 |
inputs=[
|
146 |
-
gr.
|
147 |
gr.inputs.Radio(["transcribe", "translate"], label="Task", default="transcribe"),
|
148 |
gr.inputs.Checkbox(label="Return timestamps"),
|
149 |
-
|
150 |
],
|
151 |
outputs="text",
|
152 |
layout="horizontal",
|
@@ -165,7 +165,7 @@ yt_transcribe = gr.Interface(
|
|
165 |
gr.inputs.Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL"),
|
166 |
gr.inputs.Radio(["transcribe", "translate"], label="Task", default="transcribe"),
|
167 |
gr.inputs.Checkbox(label="Return timestamps"),
|
168 |
-
|
169 |
],
|
170 |
outputs=["html", "text"],
|
171 |
layout="horizontal",
|
|
|
107 |
inputs = {"array": inputs, "sampling_rate": pipe.feature_extractor.sampling_rate}
|
108 |
|
109 |
# Map the language names to their corresponding codes
|
110 |
+
language_codes = {"English": "en", "Uzbek": 'uzbek'}
|
111 |
language_code = language_codes.get(language, "en") # Default to "en" if the language is not found
|
112 |
|
113 |
result = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task, "language": f"<|{language_code}|>"},
|
|
|
124 |
mf_transcribe = gr.Interface(
|
125 |
fn=transcribe,
|
126 |
inputs=[
|
127 |
+
gr.Audio(sources=["microphone"], type="filepath", optional=True),
|
128 |
gr.inputs.Radio(["transcribe", "translate"], label="Task", default="transcribe"),
|
129 |
gr.inputs.Checkbox(label="Return timestamps"),
|
130 |
+
gr.inputs.Dropdown(choices=["English", "Uzbek"], label="Language"),
|
131 |
],
|
132 |
outputs="text",
|
133 |
layout="horizontal",
|
|
|
143 |
file_transcribe = gr.Interface(
|
144 |
fn=transcribe,
|
145 |
inputs=[
|
146 |
+
gr.Audio(sources=["upload"], type="filepath", optional=True, label="Audio file"),
|
147 |
gr.inputs.Radio(["transcribe", "translate"], label="Task", default="transcribe"),
|
148 |
gr.inputs.Checkbox(label="Return timestamps"),
|
149 |
+
gr.inputs.Dropdown(choices=["English", "Uzbek"], label="Language"),
|
150 |
],
|
151 |
outputs="text",
|
152 |
layout="horizontal",
|
|
|
165 |
gr.inputs.Textbox(lines=1, placeholder="Paste the URL to a YouTube video here", label="YouTube URL"),
|
166 |
gr.inputs.Radio(["transcribe", "translate"], label="Task", default="transcribe"),
|
167 |
gr.inputs.Checkbox(label="Return timestamps"),
|
168 |
+
gr.inputs.Dropdown(choices=["English", "Uzbek"], label="Language"),
|
169 |
],
|
170 |
outputs=["html", "text"],
|
171 |
layout="horizontal",
|