About CelestAI CelestAI began as a personal quest to demystify the vastness of space and make its wonders more accessible. I've always been captivated by astronomy, but often found myself sifting through multiple sources to get a quick fact or a stunning image. The idea was to create a single, intuitive interface where anyone – from casual enthusiasts to curious learners – could instantly connect with the cosmos.
Inspiration: The primary inspiration stemmed from a desire to combine the conversational power of AI with the rich, publicly available data from space agencies like NASA and astronomical databases. I wanted to build an interactive companion that could answer questions, present captivating visuals, and even make learning fun through quizzes, all within a sleek, user-friendly environment.
What I Learned: This project was a deep dive into several exciting areas:
GUI Development with Tkinter: I significantly enhanced my understanding of Tkinter, learning how to create responsive layouts, manage widgets effectively, handle user input, and implement dynamic updates. The challenge of creating a modern-looking interface with theme toggling and animations pushed my boundaries. API Integration: Integrating with external APIs like NASA's APOD, space facts APIs, and trivia databases provided invaluable experience in making HTTP requests, parsing JSON data, and handling various API responses, including error states and different media types (like videos from APOD). AI Model Integration (Online & Offline): Exploring both online (OpenRouter) and offline (GPT4All) AI models was a critical learning curve. I gained insights into managing API keys securely, handling network latencies, and implementing local model inference, which involved managing large model files and understanding their performance characteristics. Multithreading: To keep the GUI responsive while fetching data from APIs or running AI inferences, I extensively used Python's threading module. This was crucial for preventing the application from freezing and ensuring a smooth user experience. Packaging with PyInstaller: Learning how to bundle a complex Python application with external data files (like the GPT4All model and GIF animations) into a single executable was a major accomplishment, enabling easy distribution. How I Built My Project:
The project was built iteratively, starting with core functionalities and then adding layers of complexity:
Core Chat System: I began by setting up the basic Tkinter window, chat box, and input field. The first step was integrating the GPT4All local model to establish the conversational AI backend. Online AI Fallback/Primary: Recognizing the limitations of local models (size, performance), I integrated the OpenRouter API as a primary or fallback AI, allowing for more diverse and up-to-date responses. Information Panels: The NASA APOD and Space Fact features were integrated next, pulling dynamic content to enrich the user experience. This involved careful handling of image downloads and display. Interactive Features: Quiz Mode, Space News, and the Timeline features were added to provide more structured interaction and learning opportunities. User Experience Enhancements: A major focus was on refining the UI/UX. This included: Theming: Implementing a dynamic dark/light theme toggle with subtle color transitions. Animations: Integrating a Lottie-like loading animation for a more engaging feel during data fetches. Voice Input/Output: Adding speech-to-text for commands and text-to-speech for AI responses, making the interaction more natural. Button States & Status Updates: Implementing clear visual feedback for ongoing operations. Packaging: Finally, PyInstaller was used to create the standalone executable, addressing the challenge of bundling large external assets. Challenges Faced:
Tkinter Responsiveness: A significant challenge was ensuring the GUI remained responsive during potentially long-running operations (like AI inference or network requests). This was overcome by leveraging threading extensively, ensuring that background tasks didn't block the main Tkinter loop. GPT4All Model Integration: Loading and correctly pathing the large GPT4All model within the PyInstaller bundle was tricky. Debugging the --add-data flags and ensuring the script could find the model's directory at runtime required careful experimentation. API Rate Limits and Error Handling: Robust error handling for network requests (timeouts, connection errors, API specific errors) was crucial. Implementing retries or informative error messages improved the application's resilience. Dynamic UI Updates: Ensuring that all UI elements updated correctly and smoothly, especially during theme changes or when new data was loaded, required meticulous attention to Tkinter's update mechanisms. Voice Input Reliability: Speech recognition can be inconsistent. Handling UnknownValueError and WaitTimeoutError from the speech_recognition library was important for a robust voice feature.
Log in or sign up for Devpost to join the conversation.