Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import requests | |
| WEBHOOK_URL = "https://hook.eu1.make.com/4cd7vhk63k8nq4c6nhmcbsi16nyf655o" | |
| def send_to_webhook(name, email): | |
| data = { | |
| "name": name, | |
| "email": email | |
| } | |
| try: | |
| response = requests.post(WEBHOOK_URL, json=data) | |
| if response.status_code == 200: | |
| return "Submitted successfully!" | |
| else: | |
| return f"Webhook error: {response.status_code} - {response.text}" | |
| except Exception as e: | |
| return f"Error: {str(e)}" | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# Submit Your Info") | |
| name = gr.Textbox(label="Name") | |
| email = gr.Textbox(label="Email") | |
| submit = gr.Button("Submit") | |
| output = gr.Textbox(label="Response") | |
| submit.click(send_to_webhook, inputs=[name, email], outputs=output) | |
| demo.launch(share=True) |