File size: 4,432 Bytes
3454dc0
 
 
 
 
 
 
774fae3
3454dc0
cba5d7a
3454dc0
bab7e89
 
774fae3
bab7e89
 
 
f5fad1d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bab7e89
 
 
 
f5fad1d
 
 
 
bab7e89
 
 
 
f5fad1d
 
 
 
bab7e89
 
 
 
f5fad1d
bab7e89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Pathora Colposcopy Assistant
emoji: πŸ”¬
colorFrom: green
colorTo: blue
sdk: docker
pinned: false
app_port: 7860
---
<!-- Updated: 2026-03-06 -->

# Pathora Colposcopy Assistant

A comprehensive React-based colposcopy assistant application with image annotation, patient history tracking, Swede Score assessment, and AI-powered chatbot features.

## Local Development

The app has two parts that need to run at the same time:
- **Backend** – FastAPI (Python) on `http://localhost:8000`
- **Frontend** – Vite dev server (React) on `http://localhost:5173`

Vite is pre-configured to proxy all `/api/*` and `/infer/*` requests to the backend.

### Step 1 – Set up your Gemini API key

Copy `.env.example` to `.env` and fill in your key:

```bash
cp .env.example .env   # or rename a copy manually on Windows
```

Edit `.env`:
```
GEMINI_API_KEY=your_actual_gemini_api_key_here
```

Get a free key at: https://makersuite.google.com/app/apikey

### Step 2 – Install Python dependencies (backend)

It is recommended to use a virtual environment:

```bash
# Create and activate a virtual environment (Windows)
python -m venv .venv
.venv\Scripts\activate

# Install backend packages
pip install -r backend/requirements.txt
```

### Step 3 – Start the FastAPI backend

From the **project root folder**, run:

```bash
uvicorn backend.app:app --host 0.0.0.0 --port 8000 --reload
```

The API will be available at `http://localhost:8000`.
You can test the health endpoint: `http://localhost:8000/health`

### Step 4 – Install Node.js dependencies (frontend)

```bash
npm install
```

### Step 5 – Start the Vite dev server

In a **separate terminal**, from the project root:

```bash
npm run dev
```

The app will be available at `http://localhost:5173`.

### Step 6 – Build for production

```bash
npm run build
```


## Deploy to Hugging Face Spaces

This project is configured for deployment on Hugging Face Spaces using Docker runtime.

### Step-by-Step Deployment Instructions

#### Step 1: Install Git and Git LFS

If you don't have Git installed:
- Download and install Git from https://git-scm.com/download/win
- Restart your terminal after installation

Install Git LFS (Large File Storage):
```bash
git lfs install
```

#### Step 2: Initialize Git Repository

Navigate to your project folder and initialize Git:
```bash
cd "c:\Users\FARRUKH SAYEED\OneDrive\Desktop\Manalife Internship\Pathora_colpo"
git init
```

#### Step 3: Add Hugging Face Remote

Add your Hugging Face Space as the remote repository:
```bash
git remote add origin https://huggingface.co/spaces/ManalifeAI/Pathora_Colposcopy_Assistant
```

#### Step 4: Stage All Files

Add all files to Git:
```bash
git add .
```

#### Step 5: Commit Your Changes

Create your first commit:
```bash
git commit -m "Initial deployment of Pathora Colposcopy Assistant"
```

#### Step 6: Push to Hugging Face

Push your code to Hugging Face Spaces:
```bash
git push -u origin main
```

**Note:** You'll be prompted for your Hugging Face credentials:
- Username: Your Hugging Face username
- Password: Use a **Hugging Face Access Token** (not your password)
  - Get token from: https://huggingface.co/settings/tokens
  - Create a new token with "write" access if you don't have one

#### Step 7: Wait for Build

After pushing:
1. Go to https://huggingface.co/spaces/ManalifeAI/Pathora_Colposcopy_Assistant
2. The Space will automatically start building from the Dockerfile
3. Wait 2-5 minutes for the build to complete
4. Your app will be live at the Space URL

### Updating Your Space

To push updates after making changes:
```bash
git add .
git commit -m "Description of your changes"
git push
```

## Local Docker Testing (Optional)

Test the Docker build locally before deploying:

```bash
# Build the image
docker build -t pathora-colposcopy .

# Run the container
docker run --rm -e PORT=7860 -p 7860:7860 pathora-colposcopy

# Open http://localhost:7860 in your browser
```

## Project Structure

- `src/` - React TypeScript source code
  - `components/` - Reusable UI components
  - `pages/` - Page components
- `public/` - Static assets
- `Dockerfile` - Docker configuration for Hugging Face Spaces
- `vite.config.ts` - Vite build configuration

## Technologies Used

- React 18
- TypeScript
- Vite
- Tailwind CSS
- Lucide React Icons
- html2pdf.js

## Space URL

πŸš€ Live at: https://huggingface.co/spaces/ManalifeAI/Pathora_Colposcopy_Assistant