Spaces:
Runtime error
Runtime error
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() |