Update app.py
Browse files
app.py
CHANGED
|
@@ -3,32 +3,13 @@ import gradio as gr
|
|
| 3 |
def chat_fn(message, history):
|
| 4 |
if history is None:
|
| 5 |
history = []
|
| 6 |
-
|
| 7 |
-
history.append({"role": "user", "content": message})
|
| 8 |
-
history.append({"role": "assistant", "content": f"Test cevap: {message}"})
|
| 9 |
-
|
| 10 |
return history
|
| 11 |
|
| 12 |
with gr.Blocks() as demo:
|
| 13 |
-
gr.Markdown("##
|
| 14 |
-
|
| 15 |
-
chatbot = gr.Chatbot(type="messages")
|
| 16 |
msg = gr.Textbox(placeholder="Sor...")
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
btn.click(chat_fn, inputs=[msg, chatbot], outputs=chatbot)
|
| 20 |
-
|
| 21 |
-
chatbot = gr.Chatbot(label="Maind.ai")
|
| 22 |
-
|
| 23 |
-
def chat_fn(message, history):
|
| 24 |
-
if history is None:
|
| 25 |
-
history = []
|
| 26 |
-
|
| 27 |
-
history.append((message, f"Test cevap: {message}"))
|
| 28 |
-
return history
|
| 29 |
-
|
| 30 |
|
| 31 |
-
demo.launch(
|
| 32 |
-
server_name="0.0.0.0",
|
| 33 |
-
server_port=7860
|
| 34 |
-
)
|
|
|
|
| 3 |
def chat_fn(message, history):
|
| 4 |
if history is None:
|
| 5 |
history = []
|
| 6 |
+
history.append((message, "AI: " + message))
|
|
|
|
|
|
|
|
|
|
| 7 |
return history
|
| 8 |
|
| 9 |
with gr.Blocks() as demo:
|
| 10 |
+
gr.Markdown("## Maind.ai 🤖")
|
| 11 |
+
chatbot = gr.Chatbot()
|
|
|
|
| 12 |
msg = gr.Textbox(placeholder="Sor...")
|
| 13 |
+
msg.submit(chat_fn, [msg, chatbot], chatbot)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
demo.launch()
|
|
|
|
|
|
|
|
|