Quantum-API / README.md
subatomicERROR's picture
Added Dockerfile and start.sh for Hugging Face deployment: FastAPI on 7860, Streamlit on 8000
29725ad
|
raw
history blame
4.72 kB
metadata
title: Quantum-API
emoji: πŸš€
colorFrom: green
colorTo: indigo
sdk: docker
python_version: 3.11
sdk_version: latest
suggested_hardware: cpu-basic
suggested_storage: small
app_file: app.py
app_port: 7860
base_path: /
fullWidth: true
header: default
short_description: Quantum-AI API for machine learning and quantum computing.
models:
  - openai-community/gpt2
datasets:
  - mozilla-foundation/common_voice_13_0
tags:
  - quantum-ai
  - machine-learning
  - fastapi
  - streamlit
  - huggingface-spaces
  - docker
thumbnail: >-
  https://cdn-uploads.huggingface.co/production/uploads/66ee940c0989ae1ac1383839/MseLCVmNge3tBJzqDbN1c.jpeg
pinned: true
hf_oauth: false
disable_embedding: false
startup_duration_timeout: 30m
custom_headers:
  cross-origin-embedder-policy: require-corp
  cross-origin-opener-policy: same-origin
  cross-origin-resource-policy: cross-origin
preload_from_hub:
  - openai-community/gpt2 config.json
license: mit

πŸš€ Quantum-API

πŸ”¬ Overview

Quantum-API is a hybrid FastAPI + Streamlit web application that serves as a unified interface for quantum computing tasks. It integrates PennyLane, PyTorch, and OpenAI models via Hugging Face. Optimized for resource-constrained systems and cloud deployments such as Hugging Face Spaces.

βš™οΈ Quantum-AI API for machine learning and quantum computing, powered by FastAPI, Streamlit, and PennyLane.


⚑ Features

  • πŸ”— FastAPI Backend: RESTful endpoints for quantum ML processing.
  • 🧠 Streamlit Frontend: Interactive quantum interface on port 7861.
  • πŸ§ͺ Quantum Computation: Process quantum logic with PennyLane.
  • πŸ“¦ Docker & HuggingFace Compatible: Pre-configured for Spaces deployment.
  • πŸ›‘οΈ Health Check: System status endpoint.
  • βš›οΈ Hybrid Quantum-Classical AI: Combines classical ML with quantum gates.

πŸ› οΈ Installation

1. Clone the Repository

git clone https://github.com/subatomicERROR/Quantum-API.git
cd Quantum-API

2. Create a Virtual Environment (Recommended)

python3 -m venv qvenv
source qvenv/bin/activate  # For Linux/macOS
# OR
qvenv\Scripts\activate  # For Windows

3. Install Requirements

pip install -r requirements.txt

πŸš€ Running the App Locally

1. Start the Backend (FastAPI)

uvicorn api.endpoints.codelama:app --host 0.0.0.0 --port 7860 --reload

Accessible at: http://localhost:7860

2. Start the Frontend (Streamlit)

streamlit run app/app.py --server.port 8000

Accessible at: http://localhost:8000


πŸ”Œ API Endpoints

🌐 Root

GET /

Returns an SEO-optimized HTML homepage.

βš›οΈ Quantum Endpoint

POST /quantum-endpoint

Request Body:

{
  "data": "your_data_here",
  "quantum_factor": 1.0
}

Response:

{
  "status": "success",
  "quantum_result": "Processed your_data_here with quantum factor 1.0"
}

❀️ Health Check

GET /health

Returns API status.


πŸ“œ Streamlit Frontend

An interactive interface to interact with the quantum backend.

streamlit run app/app.py --server.port 8000

URL: http://localhost:8000


πŸ“¦ Deployment: Hugging Face Spaces

To deploy on Hugging Face:

Ensure the following in your repo:

  • requirements.txt
  • app/app.py (Streamlit entrypoint)
  • api/endpoints/codelama.py (FastAPI backend)

Use a Docker-based Space with this command in Dockerfile or runtime:

uvicorn api.endpoints.codelama:app --host 0.0.0.0 --port 7860 & \
streamlit run app/app.py --server.port 8000

Push your repo to Hugging Face:

git remote add hf https://huggingface.co/spaces/subatomicERROR/Quantum-API
git push hf main

πŸ“ File Structure

Quantum-API/
β”œβ”€β”€ api/
β”‚   └── endpoints/
β”‚       └── codelama.py         # FastAPI main app
β”œβ”€β”€ app/
β”‚   └── app.py                  # Streamlit UI
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ README.md
└── .huggingface/README.md      # Optional Space ReadMe

🧠 Author

Built with β˜• + βš›οΈ by subatomicERROR (Yash R)
πŸ“§ Email: [email protected]


🧬 Branding & Philosophy

Part of the .ERROR brand β€” combining ancient wisdom, futuristic design, and quantum intelligence.

This system is part of the Quantum-AI Stack including:

  • Quantum-ML β€” Model & training backend.
  • Quantum-API β€” This API gateway.
  • Quantum-Compute β€” Quantum computation engine.

πŸ“ƒ License

MIT License


πŸͺ Exploring the quantum realm with AI...
...one entangled bit at a time.