casmopedia / README.md
aradhyapavan's picture
CospmoPedia
7e3b585 verified
metadata
title: CosmoPedia - Space Knowledge Hub
emoji: πŸš€
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860
pinned: false
license: apache-2.0
tags:
  - space
  - astronomy
  - knowledge-base
  - flask
  - vector-search

CosmoPedia πŸš€ - Space Knowledge Hub

An interactive space knowledge platform powered by Flask, featuring comprehensive information about space exploration, astronomy, and cosmic discoveries. This application combines traditional web interfaces with advanced vector search capabilities for intelligent space-related queries.

Features

  • 🌌 Comprehensive Space Database: Information about planets, astronauts, rockets, space agencies, telescopes, and more
  • πŸ” Vector Search: Advanced semantic search using FAISS and sentence transformers
  • πŸ€– AI Chat Interface: Interactive chat with space knowledge using Mistral AI
  • πŸ“Š Multiple Views: Browse data through organized categories
  • 🎨 Space-themed UI: Beautiful cosmic interface with preloader animations
  • πŸ›οΈ Space Museums: Information about space museums worldwide
  • πŸ“‘ Space Terminology: Comprehensive glossary of space terms

Live Demo

Try the app on Hugging Face Spaces: CosmoPedia Space Hub

Screenshots

CosmoPedia Interface

Installation

Local Development

git clone https://huggingface.co/spaces/your-username/cosmopedia
cd cosmopedia
pip install -r requirements.txt
python app.py

Docker

docker build -t cosmopedia .
docker run -p 7860:7860 cosmopedia

Usage

  1. Browse Categories: Navigate through different space-related categories
  2. Search: Use the vector search to find specific information
  3. Chat Interface: Ask questions about space using the AI chat feature
  4. Explore Data: View detailed information about space missions, astronauts, and more

API Endpoints

  • GET / - Main interface
  • GET /chat - AI chat interface
  • GET /astronauts - Astronaut information
  • GET /planets - Planetary data
  • GET /rockets - Rocket specifications
  • GET /agencies - Space agency details
  • GET /telescopes - Telescope information
  • GET /museums - Space museum locations
  • GET /terminologies - Space terminology
  • POST /api/search - Vector search endpoint
  • POST /api/chat - Chat API endpoint

Data Sources

The application includes comprehensive datasets covering:

  • Astronauts: Notable space explorers and their missions
  • Planets: Detailed planetary information
  • Rockets: Launch vehicles and specifications
  • Space Agencies: Global space organizations
  • Telescopes: Ground and space-based observatories
  • Museums: Space museums worldwide
  • Terminology: Space and astronomy glossary

Technology Stack

  • Backend: Flask (Python 3.11)
  • Vector Search: FAISS, Sentence Transformers
  • AI Integration: Mistral AI API
  • Frontend: HTML, CSS, JavaScript
  • Data Processing: JSON, NumPy, Scikit-learn
  • Deployment: Docker, Hugging Face Spaces

Configuration

Environment Variables

MISTRAL_API_KEY=your_mistral_api_key
MISTRAL_API_URL=https://api.mistral.ai/v1/chat/completions
PORT=7860

Required Files

  • knowledge_base_docs.pkl - Preprocessed documents for vector search
  • knowledge_base_index.faiss - FAISS index for semantic search
  • data/ - JSON files containing space-related datasets

File Structure

CosmoPedia/
β”œβ”€β”€ app.py                      # Main Flask application
β”œβ”€β”€ vector_search.py           # Vector search implementation
β”œβ”€β”€ requirements.txt           # Python dependencies
β”œβ”€β”€ Dockerfile                 # Docker configuration
β”œβ”€β”€ data/                      # JSON datasets
β”‚   β”œβ”€β”€ astronauts.json
β”‚   β”œβ”€β”€ planets.json
β”‚   β”œβ”€β”€ rockets.json
β”‚   └── ...
β”œβ”€β”€ templates/                 # HTML templates
β”œβ”€β”€ static/                    # CSS, JS, and assets
└── Swagger_Api/              # API documentation

Development

Adding New Data

  1. Add JSON files to the data/ directory
  2. Update the knowledge base initialization
  3. Rebuild the vector search index

Customizing the Interface

  • Modify templates in templates/
  • Update styles in static/css/
  • Add functionality in static/js/

Performance Features

  • Lazy loading of vector search components
  • Efficient FAISS indexing
  • Rate limiting for API calls
  • Optimized static asset loading

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Acknowledgments

  • Space data sourced from NASA, ESA, and other space agencies
  • Vector search powered by Hugging Face Transformers
  • UI inspired by cosmic themes and space exploration

Support

For questions or issues, please open an issue on the repository or contact the maintainers.


Built with ❀️ for space enthusiasts and cosmic explorers 🌌