Jeffgold commited on
Commit
a316e58
·
1 Parent(s): 2c8b42e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -149,13 +149,13 @@ def process_output(output):
149
  """Process output and display it appropriately."""
150
  if isinstance(output, str):
151
  # If output is a string, assume it's an error message and display it as text.
152
- return gr.outputs.Textbox()(output)
153
  elif isinstance(output, Path):
154
  # If output is a Path, assume it's an error file and provide it as a downloadable file.
155
- return gr.outputs.File()(str(output))
156
  elif isinstance(output, list):
157
  # If output is a list, assume it's a list of Paths or URLs and display it as a markdown list.
158
- return gr.outputs.Markdown()("\n".join(f"- {o}" for o in output))
159
  else:
160
  raise TypeError("Unexpected output type")
161
 
@@ -177,14 +177,15 @@ def main():
177
  ftp_path = gr.inputs.Textbox(label="FTP Path")
178
  upload = gr.inputs.Checkbox(label="Upload to FTP server", default=False)
179
 
180
- gr.Interface(
181
- convert_video,
182
- inputs=[video_file, quality, aspect_ratio, video_url, ftp_server, ftp_username, ftp_password, ftp_path, upload],
183
- outputs=[gr.outputs.Textbox(), gr.outputs.File(), gr.outputs.Markdown()],
184
- output_processor=process_output,
185
- allow_flagging=False,
186
- live=False,
187
- ).launch()
 
188
 
189
  if __name__ == "__main__":
190
  main()
 
149
  """Process output and display it appropriately."""
150
  if isinstance(output, str):
151
  # If output is a string, assume it's an error message and display it as text.
152
+ return output
153
  elif isinstance(output, Path):
154
  # If output is a Path, assume it's an error file and provide it as a downloadable file.
155
+ return str(output)
156
  elif isinstance(output, list):
157
  # If output is a list, assume it's a list of Paths or URLs and display it as a markdown list.
158
+ return "\n".join(f"- {o}" for o in output)
159
  else:
160
  raise TypeError("Unexpected output type")
161
 
 
177
  ftp_path = gr.inputs.Textbox(label="FTP Path")
178
  upload = gr.inputs.Checkbox(label="Upload to FTP server", default=False)
179
 
180
+ gr.Interface(
181
+ convert_video,
182
+ inputs=[video_file, quality, aspect_ratio, video_url, ftp_server, ftp_port, ftp_username, ftp_password, ftp_path, upload],
183
+ outputs=gr.outputs.Textbox(),
184
+ output_processor=process_output,
185
+ allow_flagging=False,
186
+ live=False,
187
+ ).launch()
188
+
189
 
190
  if __name__ == "__main__":
191
  main()