Spaces:
Paused
Paused
dev-3
commited on
Commit
·
e91f155
1
Parent(s):
ff95253
docker changes
Browse files- .env +6 -0
- Dockerfile +3 -14
- README.md +31 -2
.env
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
HF_HOME=/tmp/huggingface
|
| 2 |
+
TRANSFORMERS_CACHE=/tmp/huggingface
|
| 3 |
+
XDG_CACHE_HOME=/tmp
|
| 4 |
+
TORCH_HOME=/tmp/torch
|
| 5 |
+
WHISPER_CACHE=/tmp/whisper
|
| 6 |
+
UPLOAD_DIR=/tmp/uploads
|
Dockerfile
CHANGED
|
@@ -1,20 +1,14 @@
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
# Install system dependencies and build tools
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
-
|
| 8 |
-
pkg-config \
|
| 9 |
-
libsystemd-dev \
|
| 10 |
-
libcairo2-dev \
|
| 11 |
tesseract-ocr \
|
| 12 |
libglib2.0-0 \
|
| 13 |
libsm6 \
|
| 14 |
libxrender1 \
|
| 15 |
libxext6 \
|
| 16 |
poppler-utils \
|
| 17 |
-
gettext \
|
| 18 |
libgl1 \
|
| 19 |
&& rm -rf /var/lib/apt/lists/*
|
| 20 |
|
|
@@ -28,12 +22,7 @@ COPY requirements.txt .
|
|
| 28 |
|
| 29 |
# Install pip and dependencies
|
| 30 |
RUN pip install --upgrade pip \
|
| 31 |
-
&& pip install -r requirements.txt --no-cache-dir
|
| 32 |
-
# Remove build tools and clean up to reduce image size
|
| 33 |
-
&& apt-get remove -y build-essential pkg-config libsystemd-dev libcairo2-dev \
|
| 34 |
-
&& apt-get autoremove -y \
|
| 35 |
-
&& apt-get clean \
|
| 36 |
-
&& rm -rf /var/lib/apt/lists/*
|
| 37 |
|
| 38 |
# Copy the rest of your code
|
| 39 |
COPY . .
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
+
# Install only required system dependencies
|
|
|
|
|
|
|
| 4 |
RUN apt-get update && apt-get install -y \
|
| 5 |
+
ffmpeg \
|
|
|
|
|
|
|
|
|
|
| 6 |
tesseract-ocr \
|
| 7 |
libglib2.0-0 \
|
| 8 |
libsm6 \
|
| 9 |
libxrender1 \
|
| 10 |
libxext6 \
|
| 11 |
poppler-utils \
|
|
|
|
| 12 |
libgl1 \
|
| 13 |
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
|
|
|
|
| 22 |
|
| 23 |
# Install pip and dependencies
|
| 24 |
RUN pip install --upgrade pip \
|
| 25 |
+
&& pip install -r requirements.txt --no-cache-dir
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
# Copy the rest of your code
|
| 28 |
COPY . .
|
README.md
CHANGED
|
@@ -1,10 +1,39 @@
|
|
| 1 |
---
|
| 2 |
-
title: HNTAI
|
| 3 |
emoji: 📉
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: green
|
| 6 |
sdk: docker
|
|
|
|
| 7 |
pinned: false
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: HNTAI - Medical Data Extraction API
|
| 3 |
emoji: 📉
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: green
|
| 6 |
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
pinned: false
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# HNTAI - Medical Data Extraction API
|
| 12 |
+
|
| 13 |
+
This is a Flask-based API for extracting and processing medical data from various document formats.
|
| 14 |
+
|
| 15 |
+
## Features
|
| 16 |
+
- Document text extraction (PDF, DOCX, Images)
|
| 17 |
+
- Audio transcription
|
| 18 |
+
- Medical data extraction
|
| 19 |
+
- PHI (Protected Health Information) scrubbing
|
| 20 |
+
- Text summarization
|
| 21 |
+
|
| 22 |
+
## Deployment on Hugging Face Spaces
|
| 23 |
+
- Uses Docker for deployment
|
| 24 |
+
- All models and data are cached in /tmp
|
| 25 |
+
- Optimized for memory usage
|
| 26 |
+
- Auto-retries for model loading
|
| 27 |
+
- Proper error handling
|
| 28 |
+
|
| 29 |
+
## Environment Variables
|
| 30 |
+
All necessary environment variables are pre-configured for Hugging Face Spaces deployment.
|
| 31 |
+
|
| 32 |
+
## API Endpoints
|
| 33 |
+
- POST /upload - Upload and process medical documents
|
| 34 |
+
- POST /transcribe - Transcribe audio files
|
| 35 |
+
- POST /extract_medical_data - Extract structured medical data
|
| 36 |
+
- POST /api/generate_summary - Generate text summaries
|
| 37 |
+
- POST /api/extract_medical_data_from_audio - Process audio recordings
|
| 38 |
+
|
| 39 |
+
For more details, check the API documentation.
|