I’m using the following code on python 3.9 and it doesn’t work because it doesn’t recognise lamma_cpp_python:
from tkinter import Tk, Label, Entry, Text, Button
import llama_cpp_python as llama
model_path = "gemma.gguf"
llm = llama.Llama(model_path)
def send_message():
user_input = entry.get()
entry.delete(0, "end")
response = llm.generate_text(user_input, temperature=0.7, max_length=100)
chat_history.insert("end", f"You: {user_input}n")
chat_history.insert("end", f"Bard: {response}n")
chat_history.see("end")
window = Tk()
window.title("Chat with gemma AI")
chat_history = Text(window, width=50, height=15)
chat_history.pack()
entry = Entry(window, width=50)
entry.pack()
send_button = Button(window, text="Send", command=send_message)
send_button.pack()
window.mainloop()
I have reinstalled llama_cpp_python multiple times and have tried on python 3.11 and 3.12 with no success.
I’m using MacOS by the way
2