ScriptMaster commited on
Commit
10a2b2c
1 Parent(s): f8c027e

transformers

Browse files
Files changed (3) hide show
  1. README.md +2 -2
  2. app.py +24 -0
  3. requirements.txt +1 -0
README.md CHANGED
@@ -1,12 +1,12 @@
1
  ---
2
  title: Chatbot
3
- emoji: 🐢
4
  colorFrom: indigo
5
  colorTo: green
6
  sdk: gradio
7
  sdk_version: 4.24.0
8
  app_file: app.py
9
- pinned: false
10
  license: other
11
  ---
12
 
 
1
  ---
2
  title: Chatbot
3
+ emoji: ✨💬
4
  colorFrom: indigo
5
  colorTo: green
6
  sdk: gradio
7
  sdk_version: 4.24.0
8
  app_file: app.py
9
+ pinned: true
10
  license: other
11
  ---
12
 
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # def greet(name):
5
+ # return "Hello " + name + "!!"
6
+
7
+ # iface = gr.Interface(fn=greet, inputs="text", outputs="text")
8
+ # iface.launch()
9
+
10
+ chatbot_model = "facebook/blenderbot-100M-distill"
11
+
12
+ chatbot = pipeline(model=chatbot_model)
13
+
14
+ def echo(message, history):
15
+ return message
16
+
17
+ def chatbot_response(message, chat_history):
18
+ chat_history.append(message)
19
+ bot_message = chatbot(chat_history)
20
+ chat_history.append(bot_message)
21
+ return bot_message, chat_history
22
+
23
+ app = gr.ChatInterface(fn=chatbot_response, examples=["hello", "hola", "merhaba"], title="Echo Bot")
24
+ app.launch()
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ transformers