Inan Ince
commited on
Commit
•
6aad1e2
1
Parent(s):
7661b2b
Add application file7
Browse files
app.py
CHANGED
@@ -1,25 +1,15 @@
|
|
1 |
-
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
|
4 |
-
# Chatbot modelini
|
5 |
chatbot_model = pipeline(model="facebook/blenderbot-400M-distill")
|
6 |
|
7 |
-
#
|
8 |
-
message_list = []
|
9 |
-
response_list = []
|
10 |
-
|
11 |
def vanilla_chatbot(message, history):
|
12 |
-
#
|
13 |
-
|
14 |
-
#
|
15 |
-
response = chatbot_model(conversation)
|
16 |
-
# Yeni yanıtı global listeye ekleyin
|
17 |
-
message_list.append(message)
|
18 |
-
response_list.append(response.generated_responses[-1])
|
19 |
-
return response.generated_responses[-1]
|
20 |
|
21 |
-
# Gradio
|
22 |
demo_chatbot = gr.ChatInterface(vanilla_chatbot, title="Vanilla Chatbot", description="Enter text to start chatting.")
|
23 |
-
|
24 |
-
# Gradio uygulamasını başlatın
|
25 |
demo_chatbot.launch()
|
|
|
1 |
+
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
|
4 |
+
# Chatbot modelini tanımlayın
|
5 |
chatbot_model = pipeline(model="facebook/blenderbot-400M-distill")
|
6 |
|
7 |
+
# Gradio için fonksiyon
|
|
|
|
|
|
|
8 |
def vanilla_chatbot(message, history):
|
9 |
+
# Girdi mesajını modele gönder ve cevabı al
|
10 |
+
response = chatbot_model(message)
|
11 |
+
return response["generated_text"] # Yanıtı döndür
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
# Gradio arayüzünü başlat
|
14 |
demo_chatbot = gr.ChatInterface(vanilla_chatbot, title="Vanilla Chatbot", description="Enter text to start chatting.")
|
|
|
|
|
15 |
demo_chatbot.launch()
|