Update app.py
Browse files
app.py
CHANGED
|
@@ -44,12 +44,21 @@ def chat_with_dify(message, history):
|
|
| 44 |
return f"İstek gönderilirken hata: {str(e)}"
|
| 45 |
|
| 46 |
# Gradio arayüzünü oluştur
|
| 47 |
-
with gr.Blocks() as demo:
|
| 48 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
|
|
|
|
|
|
|
|
|
| 50 |
chatbot = gr.Chatbot(height=400)
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
| 53 |
|
| 54 |
def respond(message, chat_history):
|
| 55 |
bot_message = chat_with_dify(message, chat_history)
|
|
@@ -58,6 +67,7 @@ with gr.Blocks() as demo:
|
|
| 58 |
|
| 59 |
# Buton olayları
|
| 60 |
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
|
|
|
| 61 |
clear.click(lambda: [], outputs=[chatbot])
|
| 62 |
clear.click(lambda: "", outputs=[msg])
|
| 63 |
|
|
|
|
| 44 |
return f"İstek gönderilirken hata: {str(e)}"
|
| 45 |
|
| 46 |
# Gradio arayüzünü oluştur
|
| 47 |
+
with gr.Blocks(theme=gr.themes.Default(primary_hue="black")) as demo:
|
| 48 |
+
with gr.Row():
|
| 49 |
+
with gr.Column(scale=4):
|
| 50 |
+
gr.Markdown("# Etikos AI Chatbot")
|
| 51 |
+
with gr.Column(scale=1, min_width=100):
|
| 52 |
+
gr.Image(value="logo.png", label="", show_label=False, height=50, container=False)
|
| 53 |
|
| 54 |
+
with gr.Row():
|
| 55 |
+
clear = gr.Button("Konuşmayı Temizle")
|
| 56 |
+
|
| 57 |
chatbot = gr.Chatbot(height=400)
|
| 58 |
+
|
| 59 |
+
with gr.Row():
|
| 60 |
+
msg = gr.Textbox(label="Mesajınız", placeholder="Mesajınızı buraya yazın...")
|
| 61 |
+
send = gr.Button("Gönder")
|
| 62 |
|
| 63 |
def respond(message, chat_history):
|
| 64 |
bot_message = chat_with_dify(message, chat_history)
|
|
|
|
| 67 |
|
| 68 |
# Buton olayları
|
| 69 |
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
| 70 |
+
send.click(respond, [msg, chatbot], [msg, chatbot])
|
| 71 |
clear.click(lambda: [], outputs=[chatbot])
|
| 72 |
clear.click(lambda: "", outputs=[msg])
|
| 73 |
|