Spaces:
Sleeping
Sleeping
| 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"))) |