Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,8 +28,12 @@ def translate_line(line, temperature=0.9, max_new_tokens=256, top_p=0.95, repeti
|
|
| 28 |
return output
|
| 29 |
|
| 30 |
def translate_srt(file_info):
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
return "\n".join(translated_lines)
|
| 34 |
|
| 35 |
gr.Interface(
|
|
|
|
| 28 |
return output
|
| 29 |
|
| 30 |
def translate_srt(file_info):
|
| 31 |
+
# Assuming `file_info` is the file content as a bytes object directly
|
| 32 |
+
content = file_info.decode("utf-8") # Decode content from bytes to string
|
| 33 |
+
translated_lines = []
|
| 34 |
+
for line in parse_srt(content):
|
| 35 |
+
translated_line = translate_line(line)
|
| 36 |
+
translated_lines.append(translated_line)
|
| 37 |
return "\n".join(translated_lines)
|
| 38 |
|
| 39 |
gr.Interface(
|