Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,7 +31,7 @@ def batch_translate(texts, batch_size=8):
|
|
| 31 |
return results
|
| 32 |
|
| 33 |
def process_srt(filepath):
|
| 34 |
-
#
|
| 35 |
if filepath is None:
|
| 36 |
return None
|
| 37 |
|
|
@@ -56,14 +56,14 @@ def process_srt(filepath):
|
|
| 56 |
return output_path
|
| 57 |
|
| 58 |
# --- Gradio Interface ---
|
| 59 |
-
with gr.Blocks(title="
|
| 60 |
gr.Markdown("# 🇬🇧 English to 🇸🇦 Arabic SRT Translator")
|
| 61 |
|
| 62 |
with gr.Row():
|
| 63 |
input_file = gr.File(label="Upload English SRT", file_types=[".srt"])
|
| 64 |
output_file = gr.File(label="Download Arabic SRT")
|
| 65 |
|
| 66 |
-
btn = gr.Button("Translate
|
| 67 |
btn.click(fn=process_srt, inputs=input_file, outputs=output_file)
|
| 68 |
|
| 69 |
if __name__ == "__main__":
|
|
|
|
| 31 |
return results
|
| 32 |
|
| 33 |
def process_srt(filepath):
|
| 34 |
+
# Gradio 4 passes the file path as a string
|
| 35 |
if filepath is None:
|
| 36 |
return None
|
| 37 |
|
|
|
|
| 56 |
return output_path
|
| 57 |
|
| 58 |
# --- Gradio Interface ---
|
| 59 |
+
with gr.Blocks(title="SRT Translator") as demo:
|
| 60 |
gr.Markdown("# 🇬🇧 English to 🇸🇦 Arabic SRT Translator")
|
| 61 |
|
| 62 |
with gr.Row():
|
| 63 |
input_file = gr.File(label="Upload English SRT", file_types=[".srt"])
|
| 64 |
output_file = gr.File(label="Download Arabic SRT")
|
| 65 |
|
| 66 |
+
btn = gr.Button("Translate", variant="primary")
|
| 67 |
btn.click(fn=process_srt, inputs=input_file, outputs=output_file)
|
| 68 |
|
| 69 |
if __name__ == "__main__":
|