Spaces:
Build error
Build error
added
Browse files
app.py
CHANGED
|
@@ -1,3 +1,22 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
gr.load("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
gr.load("llmModeluser/therapy_trained_model").launch()import gradio as gr
|
| 4 |
+
import requests
|
| 5 |
+
|
| 6 |
+
API_URL = "https://api-inference.huggingface.co/models/llmModeluser/therapy_trained_model" # Replace with your actual API URL
|
| 7 |
+
|
| 8 |
+
def chat_response(user_input):
|
| 9 |
+
response = requests.post(API_URL, json={"text": user_input})
|
| 10 |
+
if response.status_code == 200:
|
| 11 |
+
return response.json()["response"] # Adjust if your API response format differs
|
| 12 |
+
else:
|
| 13 |
+
return "Error: API request failed"
|
| 14 |
+
|
| 15 |
+
iface = gr.Interface(
|
| 16 |
+
fn=chat_response,
|
| 17 |
+
inputs=gr.Textbox(lines=1, placeholder="Enter your message here..."),
|
| 18 |
+
outputs="chatbot", # Creates chatbot output history
|
| 19 |
+
title="Therapy Chatbot"
|
| 20 |
+
)
|
| 21 |
+
|
| 22 |
+
iface.launch()
|