AstroPredict is a web application that predicts the stability of asteroid orbits and estimates their future position based on orbital elements.
It combines a PyTorch machine learning model, a FastAPI backend, and a React frontend.
- Users provide orbital elements:
- a → Semi-major axis
- e → Eccentricity
- i → Inclination
- The model outputs:
- Stability probability (0–1)
- Stable / Not Stable classification
- Predicted position
(x, y, z)in AU
AstroPredict/
├── backend/
│ ├── main.py # FastAPI backend (serves the model)
│ ├── train_model.py # PyTorch model training script
│ ├── predict.py # Test predictions with model
│ ├── generate_dataset.py # Generate dataset with Rebound
│ └── asteroid_model.pth # Trained model weights
│
├── frontend/
│ ├── src/
│ │ ├── App.js # Main React router
│ │ ├── pages/
│ │ │ ├── Dashboard.js
│ │ │ ├── Asteroid_Prediction.js
│ │ │ ├── FAQ.js
│ │ │ ├── About.js
│ │ │ └── Resource.js
│ │ └── components/ # Navbar, Footer, etc.
│ └── package.json
│
└── README.md
🚀 Features
Predict orbit stability of asteroids
Estimate future 3D position (x, y, z)
Interactive React UI to enter orbital elements
REST API backend with FastAPI
Dataset generation with Rebound physics simulation
⚙️ Installation & Setup
1️⃣ Clone Repository
bash
Copy code
git clone https://github.com/KhorchaniMarwa/AstroPredict.git
cd AstroPredict
2️⃣ Backend Setup
bash
Copy code
cd backend
pip install -r requirements.txt
uvicorn main:app --reload
Backend runs on:
API → http://127.0.0.1:8000/predict
Docs → http://127.0.0.1:8000/docs
3️⃣ Frontend Setup
bash
Copy code
cd frontend
npm install
npm start
Frontend runs on: http://localhost:3000
📊 Example API Request
Input:
json
Copy code
{
"a": 2.5,
"e": 0.1,
"i": 5.0
}
Output:
json
Copy code
{
"stability_probability": 0.82,
"is_stable": true,
"predicted_position": {
"x": 1.23,
"y": -0.45,
"z": 0.67
}
}
📚 Pages
Dashboard → Overview of the project
Asteroid Prediction → Input orbital elements & view results
FAQ → Common questions
About → Information about the project/team
Resources → Useful external links
🛠️ Tech Stack
Frontend: React, React Router, Axios
Backend: FastAPI, Uvicorn
ML Framework: PyTorch
Simulation: Rebound
Languages: Python, JavaScript
📦 Backend Requirements
Create a requirements.txt in the backend folder:
txt
Copy code
fastapi
uvicorn
torch
numpy
pandas
rebound
Install with:
bash
Copy code
pip install -r requirements.txt
🤝 Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you’d like to change.
📄 License
This project is licensed under the MIT License.