Download codette_gui.py from Raiff1982/Codettes: direct link, hf CLI and curl.
- Browser
- Download file 2.09 kB
-
https://huggingface.co/spaces/Raiff1982/Codettes/resolve/main/codette_gui.py
- Command line
-
hf download hf://spaces/Raiff1982/Codettes/codette_gui.py
-
curl -L -o codette_gui.py https://huggingface.co/spaces/Raiff1982/Codettes/resolve/main/codette_gui.py
2.09 kB
| import tkinter as tk | |
| from tkinter import scrolledtext, messagebox | |
| import threading | |
| from codette.codette_core import Codette # Update path as needed | |
| class CodetteApp(tk.Tk): | |
| def __init__(self): | |
| super().__init__() | |
| self.title("Codette Universal Reasoning Assistant") | |
| self.geometry("600x400") | |
| self.configure(bg="#eef6f9") | |
| self.codette_instance = Codette() | |
| title = tk.Label(self, text="Ask Codette", font=("Helvetica", 18, "bold"), bg="#eef6f9") | |
| title.pack(pady=10) | |
| self.input_field = tk.Entry(self, font=("Calibri", 14), width=60) | |
| self.input_field.pack(pady=5) | |
| self.input_field.focus() | |
| self.input_field.bind("<Return>", lambda event: self.handle_ask()) | |
| ask_btn = tk.Button(self, text="Ask", font=("Calibri", 12), command=self.handle_ask) | |
| ask_btn.pack(pady=5) | |
| output_label = tk.Label(self, text="Codette's Answer:", bg="#eef6f9") | |
| output_label.pack() | |
| self.output_box = scrolledtext.ScrolledText(self, font=("Consolas", 12), height=10, width=70) | |
| self.output_box.pack(pady=4) | |
| clear_btn = tk.Button(self, text="Clear", command=self.clear_all) | |
| clear_btn.pack(pady=3) | |
| def handle_ask(self): | |
| user_query = self.input_field.get().strip() | |
| if not user_query: | |
| messagebox.showwarning("Input Required", "Please enter your question.") | |
| return | |
| # Use a thread to avoid blocking the UI if Codette takes time | |
| def get_response(): | |
| codette_reply = self.codette_instance.generate_response(user_query) | |
| self.output_box.insert(tk.END, f"User: {user_query}\nCodette: {codette_reply}\n\n") | |
| self.out_box_yview_bottom() | |
| threading.Thread(target=get_response, daemon=True).start() | |
| def out_box_yview_bottom(self): | |
| self.output_box.yview_moveto(1.0) | |
| def clear_all(self): | |
| self.input_field.delete(0, tk.END) | |
| self.output_box.delete('1.0', tk.END) | |
| if __name__ == "__main__": | |
| app = CodetteApp() | |
| app.mainloop() | |