Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import requests
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
GROQ_API_KEY = os.getenv("GROQ_API_KEY")
|
| 6 |
-
MODEL = "mpt-7b-chat"
|
| 7 |
|
| 8 |
def chat_with_ai(message):
|
| 9 |
response = requests.post(
|
|
@@ -18,8 +18,7 @@ def chat_with_ai(message):
|
|
| 18 |
{"role": "system", "content": "You are Mingool AI, a friendly assistant for single parents."},
|
| 19 |
{"role": "user", "content": message}
|
| 20 |
]
|
| 21 |
-
}
|
| 22 |
-
timeout=20 # make sure it waits long enough
|
| 23 |
)
|
| 24 |
data = response.json()
|
| 25 |
return data["choices"][0]["message"]["content"]
|
|
@@ -29,6 +28,7 @@ demo = gr.Interface(
|
|
| 29 |
inputs="text",
|
| 30 |
outputs="text",
|
| 31 |
title="Mingool AI Chat",
|
| 32 |
-
api_name="/chat_with_ai"
|
| 33 |
)
|
|
|
|
| 34 |
demo.launch()
|
|
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
GROQ_API_KEY = os.getenv("GROQ_API_KEY")
|
| 6 |
+
MODEL = "mosaicml/mpt-7b-chat"
|
| 7 |
|
| 8 |
def chat_with_ai(message):
|
| 9 |
response = requests.post(
|
|
|
|
| 18 |
{"role": "system", "content": "You are Mingool AI, a friendly assistant for single parents."},
|
| 19 |
{"role": "user", "content": message}
|
| 20 |
]
|
| 21 |
+
}
|
|
|
|
| 22 |
)
|
| 23 |
data = response.json()
|
| 24 |
return data["choices"][0]["message"]["content"]
|
|
|
|
| 28 |
inputs="text",
|
| 29 |
outputs="text",
|
| 30 |
title="Mingool AI Chat",
|
| 31 |
+
api_name="/chat_with_ai" # ✅ this is critical
|
| 32 |
)
|
| 33 |
+
|
| 34 |
demo.launch()
|