Spaces:
Build error
Build error
Alex Volkov
commited on
Commit
•
8d6dff7
1
Parent(s):
4e218ca
Trying to make fetch happen, it's not going to happen
Browse files- app.py +2 -1
- download.py +1 -0
- utils/apis.py +3 -1
app.py
CHANGED
@@ -115,4 +115,5 @@ def temp():
|
|
115 |
|
116 |
if __name__ == "__main__":
|
117 |
gradio.close_all()
|
118 |
-
|
|
|
|
115 |
|
116 |
if __name__ == "__main__":
|
117 |
gradio.close_all()
|
118 |
+
port = os.environ.get('GRADIO_SERVER_PORT', 8111)
|
119 |
+
demo.launch(show_error=True, debug=True, share=gradio_share, favicon_path='fonts/icon.png')
|
download.py
CHANGED
@@ -33,6 +33,7 @@ def download_generator(url):
|
|
33 |
yield {"message": f"Checking {url} for videos"}
|
34 |
try:
|
35 |
meta = check_download(url)
|
|
|
36 |
if(meta['duration'] > 5 * 60):
|
37 |
raise Exception("Video is too long, please use videos less than 5 minutes")
|
38 |
yield {"message": f"Found video with {meta['duration']} seconds duration from {meta['extractor']}", "meta": meta}
|
|
|
33 |
yield {"message": f"Checking {url} for videos"}
|
34 |
try:
|
35 |
meta = check_download(url)
|
36 |
+
print(json.dumps(meta, indent=2))
|
37 |
if(meta['duration'] > 5 * 60):
|
38 |
raise Exception("Video is too long, please use videos less than 5 minutes")
|
39 |
yield {"message": f"Found video with {meta['duration']} seconds duration from {meta['extractor']}", "meta": meta}
|
utils/apis.py
CHANGED
@@ -16,7 +16,9 @@ from download import download_generator
|
|
16 |
|
17 |
@anvil.server.callable
|
18 |
def call_gradio_api(api_name='test_api', data=()):
|
19 |
-
|
|
|
|
|
20 |
payload = json.dumps({"data": data})
|
21 |
headers = {
|
22 |
'accept': 'application/json',
|
|
|
16 |
|
17 |
@anvil.server.callable
|
18 |
def call_gradio_api(api_name='test_api', data=()):
|
19 |
+
port = os.environ.get('GRADIO_SERVER_PORT', 8111)
|
20 |
+
gradio_base_url = os.environ.get('GRADIO_URL', f'http://127.0.0.1:{port}/api/')
|
21 |
+
gradio_url = f"{gradio_base_url}{api_name}"
|
22 |
payload = json.dumps({"data": data})
|
23 |
headers = {
|
24 |
'accept': 'application/json',
|