Download codette_app.py from Raiff1982/Codettes: direct link, hf CLI and curl.
- Browser
- Download file 1.94 kB
-
https://huggingface.co/spaces/Raiff1982/Codettes/resolve/main/codette_app.py
- Command line
-
hf download hf://spaces/Raiff1982/Codettes/codette_app.py
-
curl -L -o codette_app.py https://huggingface.co/spaces/Raiff1982/Codettes/resolve/main/codette_app.py
1.94 kB
| import tkinter as tk | |
| from tkinter import scrolledtext, messagebox | |
| class CodetteApp(tk.Tk): | |
| def __init__(self): | |
| super().__init__() | |
| self.title("Codette Universal Reasoning Assistant") | |
| self.geometry("600x400") | |
| self.configure(bg="#eef6f9") | |
| # Title label | |
| title = tk.Label(self, text="Ask Codette", font=("Helvetica", 18, "bold"), bg="#eef6f9") | |
| title.pack(pady=10) | |
| # Input field | |
| self.input_field = tk.Entry(self, font=("Calibri", 14), width=60) | |
| self.input_field.pack(pady=5) | |
| self.input_field.focus() | |
| # Ask button | |
| ask_btn = tk.Button(self, text="Ask", font=("Calibri", 12), command=self.handle_ask) | |
| ask_btn.pack(pady=5) | |
| # Output box | |
| 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 button | |
| 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 | |
| # TEMP: Dummy response until we connect to AI backend logic. | |
| codette_reply = f"[Pretend answer] You asked: '{user_query}'" | |
| self.output_box.insert(tk.END, f"User: {user_query}\nCodette: {codette_reply}\n\n") | |
| self.out_box_yview_bottom() | |
| def out_box_yview_bottom(self): | |
| ''' Scroll output box to bottom ''' | |
| 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() | |