Upload 3 files
Browse files
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
def generate(message):
|
5 |
+
url = "https://p-bot-h629.onrender.com/ask"
|
6 |
+
headers = {"Content-Type": "application/json"}
|
7 |
+
data = {"text": message}
|
8 |
+
response = requests.post(url, json=data, headers=headers)
|
9 |
+
return response.text
|
10 |
+
|
11 |
+
# Настройка интерфейса чат-бота
|
12 |
+
mychatbot = gr.Chatbot(avatar_images=["./user.png", "./bot.png"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=True)
|
13 |
+
|
14 |
+
# Создание интерфейса для чат-бота
|
15 |
+
demo = gr.ChatInterface(fn=generate,
|
16 |
+
chatbot=mychatbot,
|
17 |
+
title="ХахБот",
|
18 |
+
retry_btn=None,
|
19 |
+
undo_btn=None
|
20 |
+
)
|
21 |
+
|
22 |
+
# Запуск демонстрации чат-бота
|
23 |
+
demo.queue().launch(share=True)
|
botm.png
ADDED
user.png
ADDED