Spaces:
Runtime error
Runtime error
ahmedJaafari
commited on
Commit
•
19bf4f8
1
Parent(s):
f6023d6
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# prompt: make a gradio app with one input video_url
|
2 |
+
import json
|
3 |
+
import requests
|
4 |
+
import gradio as gr
|
5 |
+
import os
|
6 |
+
|
7 |
+
def submit_video(video_url):
|
8 |
+
url = os.getenv("URL")
|
9 |
+
payload = {"video_url": video_url}
|
10 |
+
headers = {
|
11 |
+
"Accept": "*/*",
|
12 |
+
"Accept-Encoding": "gzip, deflate",
|
13 |
+
"Authorization":
|
14 |
+
f"Basic {os.getenv("SECRET_TOKEN")}",
|
15 |
+
"Connection": "keep-alive",
|
16 |
+
"Content-Type": "application/json"
|
17 |
+
}
|
18 |
+
|
19 |
+
response = requests.request("POST",
|
20 |
+
url,
|
21 |
+
headers=headers,
|
22 |
+
data=json.dumps(payload))
|
23 |
+
|
24 |
+
return f"Task Successfully Submited. Task ID: {response.json()['task_id']}"
|
25 |
+
|
26 |
+
demo = gr.Interface(fn=submit_video, inputs=[{"name": "text", "label": "Video URL"}], outputs=[{"name": "text", "label": "Task ID"}])
|
27 |
+
demo.launch()
|