Update app.py
Browse files
app.py
CHANGED
|
@@ -7,22 +7,18 @@ def chat_fn(message, history):
|
|
| 7 |
if history is None:
|
| 8 |
history = []
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
-
history.append(
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
"model": "mistral",
|
| 17 |
-
"prompt": message,
|
| 18 |
-
"stream": False
|
| 19 |
-
}
|
| 20 |
|
| 21 |
-
|
| 22 |
-
reply = r.json()["response"]
|
| 23 |
|
| 24 |
-
history.append((message, reply))
|
| 25 |
-
return history, ""
|
| 26 |
|
| 27 |
with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as demo:
|
| 28 |
# LOGO
|
|
@@ -43,6 +39,10 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as demo:
|
|
| 43 |
inputs=[msg, chatbot],
|
| 44 |
outputs=[chatbot, msg]
|
| 45 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
demo.launch(
|
| 48 |
server_name="0.0.0.0",
|
|
|
|
| 7 |
if history is None:
|
| 8 |
history = []
|
| 9 |
|
| 10 |
+
history.append({
|
| 11 |
+
"role": "user",
|
| 12 |
+
"content": message
|
| 13 |
+
})
|
| 14 |
|
| 15 |
+
history.append({
|
| 16 |
+
"role": "assistant",
|
| 17 |
+
"content": f"Test cevap: {message}"
|
| 18 |
+
})
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
+
return history
|
|
|
|
| 21 |
|
|
|
|
|
|
|
| 22 |
|
| 23 |
with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue")) as demo:
|
| 24 |
# LOGO
|
|
|
|
| 39 |
inputs=[msg, chatbot],
|
| 40 |
outputs=[chatbot, msg]
|
| 41 |
)
|
| 42 |
+
chatbot = gr.Chatbot(
|
| 43 |
+
label="Maind.ai",
|
| 44 |
+
type="messages"
|
| 45 |
+
)
|
| 46 |
|
| 47 |
demo.launch(
|
| 48 |
server_name="0.0.0.0",
|