echo-chatbot / app.py
Sleik's picture
Upload folder using huggingface_hub
ae7d960 verified
raw
history blame contribute delete
No virus
834 Bytes
import ollama
import gradio as gr
def chat(question, history):
history_format = []
for human, assistant in history:
history_format.append({"role": "user", "content": human})
history_format.append({"role": "assistant", "content":assistant})
history_format.append({'role': 'user', 'content': question})
messages=history_format
stream = ollama.chat(model='llama3', messages=messages)
#print(history_format)
return stream['message']['content']
# Gradio interface
assistant_icon = gr.Image(value="C:/Users/chris/Downloads/japanese-lama-ghibli-artstyle.jpeg", width=32, height=32) # adjust the size as needed
assistant_img = gr.Image(value="C:/Users/chris/Downloads/japanese-lama-ghibli-artstyle.jpeg", elem_id="assistant_img")
gr.ChatInterface(fn=chat, title="Chat Bot",chatbot=gr.Chatbot(height=300)).launch()