Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,18 @@ import requests
|
|
7 |
from urllib.parse import urlparse
|
8 |
import subprocess
|
9 |
import atexit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
logging.basicConfig(level=logging.INFO)
|
12 |
|
@@ -87,7 +99,8 @@ def convert_video(video_file, quality, aspect_ratio, video_url):
|
|
87 |
|
88 |
html = ""
|
89 |
for path in output_paths:
|
90 |
-
|
|
|
91 |
return html
|
92 |
|
93 |
video_file = gr.inputs.File(label="Video File")
|
|
|
7 |
from urllib.parse import urlparse
|
8 |
import subprocess
|
9 |
import atexit
|
10 |
+
from flask import Flask, send_from_directory
|
11 |
+
from threading import Thread
|
12 |
+
|
13 |
+
# Initialize a Flask application
|
14 |
+
app = Flask(__name__)
|
15 |
+
|
16 |
+
@app.route('/files/<path:path>')
|
17 |
+
def serve_file(path):
|
18 |
+
return send_from_directory(Path.cwd(), path)
|
19 |
+
|
20 |
+
# Start the Flask server in a new thread
|
21 |
+
Thread(target=app.run, kwargs={'host': '0.0.0.0', 'port': 5000}).start()
|
22 |
|
23 |
logging.basicConfig(level=logging.INFO)
|
24 |
|
|
|
99 |
|
100 |
html = ""
|
101 |
for path in output_paths:
|
102 |
+
# Replace 'localhost' with your server's IP address if necessary
|
103 |
+
html += f'<p><a href="http://localhost:5000/files/{path.name}" target="_blank">{path.stem}</a></p>'
|
104 |
return html
|
105 |
|
106 |
video_file = gr.inputs.File(label="Video File")
|