Gustavo Monti Rocha commited on
Commit
5a06c7a
โ€ข
1 Parent(s): 665e637

Add application file

Browse files
Files changed (3) hide show
  1. README.md +6 -6
  2. app.py +17 -0
  3. requirements.txt +3 -0
README.md CHANGED
@@ -1,13 +1,13 @@
1
  ---
2
- title: Chatbot
3
- emoji: ๐Ÿƒ
4
- colorFrom: indigo
5
- colorTo: pink
6
  sdk: gradio
7
- sdk_version: 4.7.1
8
  app_file: app.py
9
  pinned: false
10
- license: mit
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: My First Space
3
+ emoji: ๐Ÿ 
4
+ colorFrom: pink
5
+ colorTo: yellow
6
  sdk: gradio
7
+ sdk_version: 3.39.0
8
  app_file: app.py
9
  pinned: false
 
10
  ---
11
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
13
+ Link to app: https://huggingface.co/spaces/shawhin/my-first-space
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline, Conversation
2
+ import gradio as gr
3
+
4
+ chatbot = pipeline(model="facebook/blenderbot-400M-distill")
5
+
6
+ message_list = []
7
+ response_list = []
8
+
9
+ def vanilla_chatbot(message, history):
10
+ conversation = Conversation(text=message, past_user_inputs=message_list, generated_responses=response_list)
11
+ conversation = chatbot(conversation)
12
+
13
+ return conversation.generated_responses[-1]
14
+
15
+ demo_chatbot = gr.ChatInterface(vanilla_chatbot, title="Vanilla Chatbot", description="Enter text to start chatting.")
16
+
17
+ demo_chatbot.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio==3.39.0
2
+ transformers==4.31.0
3
+ torch==2.0.1