add gui
This commit is contained in:
@@ -19,6 +19,8 @@
|
||||
buildInputs = with pkgs; [
|
||||
(python311.withPackages (ps: with ps; [
|
||||
ollama
|
||||
tkinter
|
||||
customtkinter
|
||||
]))
|
||||
];
|
||||
|
||||
|
||||
45
src/siren.py
45
src/siren.py
@@ -1,23 +1,46 @@
|
||||
import ollama
|
||||
import sys
|
||||
import customtkinter as ctk
|
||||
|
||||
client = ollama.Client(
|
||||
class App(ctk.CTk):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.geometry('600x500')
|
||||
self.title('Siren')
|
||||
|
||||
def chat():
|
||||
return client.chat(model=model, messages=messages)['message']['content']
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
client = ollama.Client(
|
||||
host='https://ollama.blunkall.us'
|
||||
)
|
||||
|
||||
messages = []
|
||||
messages = []
|
||||
|
||||
response = ''
|
||||
response = ''
|
||||
|
||||
model = 'llama3.2'
|
||||
model = 'llama3.2'
|
||||
|
||||
userInput = ''
|
||||
userInput = ''
|
||||
|
||||
print('Enter a prompt!')
|
||||
gui = False
|
||||
|
||||
while(userInput != 'stop'):
|
||||
userInput = input()
|
||||
if(userInput != 'stop'):
|
||||
messages += [{ 'role': 'user', 'content': userInput, 'stream': False }]
|
||||
print(client.chat(model=model, messages=messages)['message']['content'])
|
||||
for a in sys.argv:
|
||||
if a == '--gui':
|
||||
gui = True
|
||||
|
||||
print('Enter a prompt!')
|
||||
|
||||
while(gui == False and userInput != 'stop'):
|
||||
userInput = input()
|
||||
if(userInput != 'stop'):
|
||||
messages += [{ 'role': 'user', 'content': userInput, 'stream': False }]
|
||||
print(chat())
|
||||
|
||||
if(gui):
|
||||
app = App()
|
||||
app.mainloop()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user