Update app.py
Browse files
app.py
CHANGED
|
@@ -1,50 +1,26 @@
|
|
| 1 |
-
|
| 2 |
import requests
|
| 3 |
-
import json
|
| 4 |
|
| 5 |
-
|
|
|
|
|
|
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
<title>์ด๋ฉ์ผ ์ ์ก</title>
|
| 13 |
-
<meta charset="utf-8">
|
| 14 |
-
</head>
|
| 15 |
-
<body>
|
| 16 |
-
<h1>์ด๋ฉ์ผ ์นํ
์ ์ก</h1>
|
| 17 |
-
<form method="POST">
|
| 18 |
-
<input type="email" name="email" placeholder="์ด๋ฉ์ผ ์ฃผ์ ์
๋ ฅ" required>
|
| 19 |
-
<input type="submit" value="์ ์ก">
|
| 20 |
-
</form>
|
| 21 |
-
{% if result %}
|
| 22 |
-
<p>{{ result }}</p>
|
| 23 |
-
{% endif %}
|
| 24 |
-
</body>
|
| 25 |
-
</html>
|
| 26 |
-
'''
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
if response.status_code == 200:
|
| 38 |
-
try:
|
| 39 |
-
result = f"์ฑ๊ณต!\n{json.dumps(response.json(), indent=2, ensure_ascii=False)}"
|
| 40 |
-
except:
|
| 41 |
-
result = f"์ฑ๊ณต!\n{response.text}"
|
| 42 |
-
else:
|
| 43 |
-
result = f"์ค๋ฅ: {response.status_code}\n{response.text}"
|
| 44 |
-
except Exception as e:
|
| 45 |
-
result = f"์ค๋ฅ ๋ฐ์: {str(e)}"
|
| 46 |
-
|
| 47 |
-
return render_template_string(HTML_TEMPLATE, result=result)
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
import requests
|
|
|
|
| 3 |
|
| 4 |
+
def send_webhook(email):
|
| 5 |
+
webhook_url = "https://connect.pabbly.com/workflow/sendwebhookdata/IjU3NjYwNTZmMDYzMDA0M2M1MjZiNTUzMzUxMzUi_pc"
|
| 6 |
+
payload = {"email": email}
|
| 7 |
|
| 8 |
+
try:
|
| 9 |
+
response = requests.post(webhook_url, json=payload)
|
| 10 |
+
return f"์๋ต ์ฝ๋: {response.status_code}\n์๋ต ๋ด์ฉ: {response.text}"
|
| 11 |
+
except Exception as e:
|
| 12 |
+
return f"์๋ฌ ๋ฐ์: {str(e)}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
+
# ์ธํฐํ์ด์ค ์์ฑ
|
| 15 |
+
demo = gr.Interface(
|
| 16 |
+
fn=send_webhook,
|
| 17 |
+
inputs=gr.Textbox(label="์ด๋ฉ์ผ ์ฃผ์", placeholder="์ด๋ฉ์ผ์ ์
๋ ฅํ์ธ์"),
|
| 18 |
+
outputs=gr.Textbox(label="๊ฒฐ๊ณผ"),
|
| 19 |
+
title="์ด๋ฉ์ผ ์นํ
์ ์ก",
|
| 20 |
+
description="์
๋ ฅํ ์ด๋ฉ์ผ ์ฃผ์๋ฅผ ์นํ
์ผ๋ก ์ ์กํฉ๋๋ค.",
|
| 21 |
+
live=False
|
| 22 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
+
# ์ฑ ์คํ
|
| 25 |
+
if __name__ == "__main__":
|
| 26 |
+
demo.queue().launch(share=False, server_port=7860)
|