Spaces:
Sleeping
Sleeping
File size: 803 Bytes
534de65 fc15049 534de65 fc15049 534de65 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
import os
import gradio
import requests
headers = {
'accept': 'application/json',
'Content-Type': 'application/json'
}
def trigger(id):
json_data = {
'conf': {
'id': id.strip(),
},
}
response = requests.post(f'http://{os.environ.get("IP_ADDRESS")}:8080/api/v1/dags/{os.environ.get("DAG_ID")}/dagRuns', headers=headers, json=json_data, auth=(os.environ.get("USERNAME"),os.environ.get("PASSWORD")))
return response.status_code
id_name = gradio.Textbox(label="ID")
response_status = gradio.Textbox(label="Response Status")
interface = gradio.Interface(
trigger,
id_name,
response_status,
title="Edit Trigger"
)
if __name__=="__main__":
interface.launch(auth=(os.environ.get("GRADIO_USERNAME"), os.environ.get("GRADIO_PASSWORD"))) |