youtube / app.py
ahmedJaafari's picture
Update app.py
cf8bf73
raw
history blame
832 Bytes
# prompt: make a gradio app with one input video_url
import json
import requests
import gradio as gr
import os
def submit_video(video_url):
url = os.getenv("URL")
payload = {"video_url": video_url}
headers = {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Authorization":
f"Basic {os.getenv('SECRET_TOKEN')}",
"Connection": "keep-alive",
"Content-Type": "application/json"
}
response = requests.request("POST",
url,
headers=headers,
data=json.dumps(payload))
return f"Task Successfully Submited. Task ID: {response.json()['task_id']}"
demo = gr.Interface(fn=submit_video, inputs=[{"name": "text", "label": "Video URL"}], outputs=[{"name": "text", "label": "Task ID"}])
demo.launch()