Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
WEBHOOK_URL = "https://gauthierlmd.app.n8n.cloud/webhook-test/64a72021-7959-4b68-bd20-f569846a3f48"
|
| 5 |
+
|
| 6 |
+
def send_to_n8n(user_input):
|
| 7 |
+
response = requests.post(
|
| 8 |
+
WEBHOOK_URL,
|
| 9 |
+
json={"text": user_input}
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
try:
|
| 13 |
+
return response.json()["output"]
|
| 14 |
+
except:
|
| 15 |
+
return "Error: no response"
|
| 16 |
+
|
| 17 |
+
iface = gr.Interface(
|
| 18 |
+
fn=send_to_n8n,
|
| 19 |
+
inputs="text",
|
| 20 |
+
outputs="text",
|
| 21 |
+
title="AI Business Analyzer",
|
| 22 |
+
description="Enter business situation to analyze"
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
iface.launch()
|