Spaces:
Paused
Paused
Update app.py
Browse files
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
|
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
|
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
|
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 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
|
|
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()
|