File size: 829 Bytes
d87d078
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
31
32
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)