File size: 711 Bytes
b92f986
 
 
 
 
 
6a25bc8
b92f986
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
print("Importing packages...")
from transformers import pipeline, Conversation
import gradio as gr
print("Done!")

print("Importing chatbot...")
chatbot = pipeline(task="conversational", model="meta-llama/Llama-2-70b")
print("Done!")

message_list = []
response_list = []

print("Creating gradio interface...")
def chocolate_chatbot(message, history):
  conversation = Conversation(text=message, past_user_inputs=message_list, generated_responses=response_list)
  conversation = chatbot(conversation)

  return conversation.generated_responses[-1]

gr_chatbot = gr.ChatInterface(chocolate_chatbot, title="Chocolate Chatbot", description="Enter text to start chatting.")
print("Launching...")
gr_chatbot.launch()