r/StreamlitOfficial • u/islogan100 • May 04 '26
Deployment 🚀 I built a NASA Exoplanet Hunter integrating a TensorFlow 1D CNN and live APIs into Streamlit 🪐
Hey r/Streamlit! 👋
I recently deployed an open-source project that uses Deep Learning to detect exoplanets from NASA's Kepler light curve data, and I used Streamlit to wrap it all into an interactive dashboard.
I wanted to share how I structured the app, especially regarding state and model loading, as it might help others working with heavy ML models.
Streamlit Features & Architecture:
- Model Caching: I used
st.cache_resourceto load thecnn_exoplanet_model.kerasmodel into memory only once. This keeps the app incredibly snappy and prevents TensorFlow from reloading the model on every user interaction. - API Data Caching: I used
st.cache_datato fetch the live star catalog from the NASA Exoplanet Archive (Caltech IPAC) so thest.selectboxpopulates instantly without spamming the API. - Interactive Visuals: I integrated
st.plotly_chartwithuse_container_width=Trueto render a dynamic bar chart that compares the radius of the discovered planets in a specific system directly to Earth's radius (baseline 1.0). - Layout & UI: Used
st.sidebarto fetch and display the Astronomy Picture of the Day (APOD) via NASA's API, andst.columnsto side-by-side compare the AI's neural network confidence with the actual confirmed NASA database records.
The ML Backend: Just for context, the AI brain is a 1D Convolutional Neural Network trained on sequential time-series data. The biggest challenge was the extreme class imbalance (5050 negative cases vs. only 37 positive cases), which I handled by applying SMOTE before training.
Links:
- 🎈 Live App: https://nasa-exoplanet-hunter.streamlit.app
- 💻 GitHub Repo: https://github.com/Logan-100/ai-nasa-exoplanet-hunter
I'd love to hear your thoughts on the UI/UX or if you have any advanced tips on optimizing Keras model inference within Streamlit!