File size: 4,719 Bytes
35d830a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71ce173
35d830a
71ce173
 
35d830a
 
 
 
71ce173
35d830a
71ce173
 
35d830a
71ce173
35d830a
71ce173
 
 
35d830a
71ce173
 
35d830a
71ce173
35d830a
71ce173
35d830a
71ce173
 
29725ad
71ce173
35d830a
29725ad
35d830a
71ce173
 
 
35d830a
71ce173
35d830a
71ce173
35d830a
71ce173
35d830a
71ce173
35d830a
71ce173
 
 
 
35d830a
 
 
 
71ce173
35d830a
71ce173
 
35d830a
 
 
 
71ce173
35d830a
71ce173
35d830a
71ce173
35d830a
 
 
71ce173
35d830a
71ce173
35d830a
71ce173
35d830a
71ce173
29725ad
71ce173
35d830a
29725ad
35d830a
71ce173
35d830a
71ce173
35d830a
71ce173
35d830a
71ce173
 
 
 
35d830a
71ce173
 
35d830a
29725ad
71ce173
35d830a
 
71ce173
 
 
 
35d830a
71ce173
35d830a
71ce173
35d830a
71ce173
35d830a
 
 
 
 
 
 
 
 
71ce173
35d830a
71ce173
 
 
35d830a
71ce173
 
35d830a
71ce173
35d830a
71ce173
35d830a
71ce173
35d830a
71ce173
35d830a
71ce173
 
 
35d830a
71ce173
35d830a
71ce173
 
 
 
 
35d830a
71ce173
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
---
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
```bash
git clone https://github.com/subatomicERROR/Quantum-API.git
cd Quantum-API
```

### 2. Create a Virtual Environment (Recommended)
```bash
python3 -m venv qvenv
source qvenv/bin/activate  # For Linux/macOS
# OR
qvenv\Scripts\activate  # For Windows
```

### 3. Install Requirements
```bash
pip install -r requirements.txt
```

---

## πŸš€ Running the App Locally

### 1. Start the Backend (FastAPI)
```bash
uvicorn api.endpoints.codelama:app --host 0.0.0.0 --port 7860 --reload
```

Accessible at: [http://localhost:7860](http://localhost:7860)

### 2. Start the Frontend (Streamlit)
```bash
streamlit run app/app.py --server.port 8000
```

Accessible at: [http://localhost:8000](http://localhost:8000)

---

## πŸ”Œ API Endpoints

### 🌐 Root

**GET /**

Returns an SEO-optimized HTML homepage.

### βš›οΈ Quantum Endpoint

**POST /quantum-endpoint**

**Request Body:**
```json
{
  "data": "your_data_here",
  "quantum_factor": 1.0
}
```

**Response:**
```json
{
  "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.

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

URL: [http://localhost:8000](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:
```bash
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:
```bash
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.