File size: 1,203 Bytes
6a8c09b
6d854f4
 
ef4ed23
 
6a8c09b
ef4ed23
6d854f4
6a8c09b
 
ef4ed23
6a8c09b
 
6d854f4
6a8c09b
 
 
ef4ed23
 
 
 
6a8c09b
 
ef4ed23
6a8c09b
 
6d854f4
6a8c09b
 
 
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 gradio as gr
import requests

def send_webhook(email, input_text):
    # ์ด๋ฉ”์ผ ์ฃผ์†Œ๋งŒ ์›นํ›…์œผ๋กœ ์ „์†ก
    webhook_url = "https://connect.pabbly.com/workflow/sendwebhookdata/IjU3NjYwNTZmMDYzMDA0M2M1MjZiNTUzMzUxMzUi_pc"
    payload = {"email": email}  # ์ด๋ฉ”์ผ๋งŒ ํฌํ•จ

    try:
        response = requests.post(webhook_url, json=payload)
        return f"์ž…๋ ฅํ•œ ์ด๋ฉ”์ผ: {email}\n์ž…๋ ฅํ•œ ํ…์ŠคํŠธ: {input_text}\n\n์ „์†ก๋œ ์ด๋ฉ”์ผ ์ฃผ์†Œ์— ๋Œ€ํ•œ ์›นํ›… ์‘๋‹ต:\n์‘๋‹ต ์ฝ”๋“œ: {response.status_code}\n์‘๋‹ต ๋‚ด์šฉ: {response.text}"
    except Exception as e:
        return f"์—๋Ÿฌ ๋ฐœ์ƒ: {str(e)}"

# ์ธํ„ฐํŽ˜์ด์Šค ์ƒ์„ฑ
demo = gr.Interface(
    fn=send_webhook, 
    inputs=[
        gr.Textbox(label="์ด๋ฉ”์ผ ์ฃผ์†Œ", placeholder="์ด๋ฉ”์ผ์„ ์ž…๋ ฅํ•˜์„ธ์š”"),
        gr.Textbox(label="์ž…๋ ฅ๊ฐ’", placeholder="ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”")
    ],
    outputs=gr.Textbox(label="๊ฒฐ๊ณผ"),
    title="์ด๋ฉ”์ผ ์›นํ›… ์ „์†ก",
    description="์ด๋ฉ”์ผ ์ฃผ์†Œ์™€ ํ…์ŠคํŠธ๋ฅผ ์ž…๋ ฅ๋ฐ›๊ณ , ์ด๋ฉ”์ผ ์ฃผ์†Œ๋งŒ ์›นํ›…์œผ๋กœ ์ „์†กํ•ฉ๋‹ˆ๋‹ค.",
    live=False
)

# ์•ฑ ์‹คํ–‰
if __name__ == "__main__":
    demo.queue().launch(share=False, server_port=7860)