Код: Выделить всё
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()
Кстати, я использую MacOS
п>
Подробнее здесь: https://stackoverflow.com/questions/784 ... cpp-python