Spaces:
Runtime error
Runtime error
Commit
·
f07e6a2
1
Parent(s):
d64b3b1
lang code update
Browse files
app.py
CHANGED
@@ -42,7 +42,7 @@ def transcribe(inputs, task, return_timestamps, language):
|
|
42 |
raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
|
43 |
|
44 |
# Map the language names to their corresponding codes
|
45 |
-
language_codes = {"English": "en", "Uzbek": "
|
46 |
language_code = language_codes.get(language, "en") # Default to "en" if the language is not found
|
47 |
result = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task, "language": f"<|{language_code}|>"},
|
48 |
return_timestamps=return_timestamps)
|
@@ -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,7 +124,7 @@ demo = gr.Blocks()
|
|
124 |
mf_transcribe = gr.Interface(
|
125 |
fn=transcribe,
|
126 |
inputs=[
|
127 |
-
gr.Audio(source="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"),
|
@@ -143,7 +143,7 @@ mf_transcribe = gr.Interface(
|
|
143 |
file_transcribe = gr.Interface(
|
144 |
fn=transcribe,
|
145 |
inputs=[
|
146 |
-
gr.Audio(source="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"),
|
|
|
42 |
raise gr.Error("No audio file submitted! Please upload or record an audio file before submitting your request.")
|
43 |
|
44 |
# Map the language names to their corresponding codes
|
45 |
+
language_codes = {"English": "en", "Uzbek": "uzbek"}
|
46 |
language_code = language_codes.get(language, "en") # Default to "en" if the language is not found
|
47 |
result = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task, "language": f"<|{language_code}|>"},
|
48 |
return_timestamps=return_timestamps)
|
|
|
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.inputs.Audio(source="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"),
|
|
|
143 |
file_transcribe = gr.Interface(
|
144 |
fn=transcribe,
|
145 |
inputs=[
|
146 |
+
gr.inputs.Audio(source="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"),
|