younes21000 commited on
Commit
934042e
·
verified ·
1 Parent(s): 3cf90f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -101,7 +101,8 @@ def download_word():
101
  file_path = "translated_subtitles.docx"
102
  doc.save(file_path)
103
 
104
- return f"Translated subtitles saved as Word document: {file_path}"
 
105
 
106
  except Exception as e:
107
  return f"Error in saving subtitles as Word: {e}"
@@ -169,7 +170,7 @@ with gr.Blocks() as demo:
169
  # Download as Word
170
  with gr.Row():
171
  download_button = gr.Button("Download as Word")
172
- download_status = gr.Textbox(label="Download Status")
173
 
174
  download_button.click(download_word, inputs=None, outputs=download_status)
175
 
 
101
  file_path = "translated_subtitles.docx"
102
  doc.save(file_path)
103
 
104
+ # Return the file for download
105
+ return file_path # Return the file path to allow Gradio to serve it as a downloadable file
106
 
107
  except Exception as e:
108
  return f"Error in saving subtitles as Word: {e}"
 
170
  # Download as Word
171
  with gr.Row():
172
  download_button = gr.Button("Download as Word")
173
+ download_status = gr.File(label="Download Translated Word File") # File output for Word download
174
 
175
  download_button.click(download_word, inputs=None, outputs=download_status)
176