CoolFace
Apppublic

CultriX/Generate-Knowledge-Graphs

sourceHugging Facemitupdated 1y agoView on Hugging Face
3likes
README_HF_SPACES.md70 linesDownload Raw Back to root
1# Hugging Face Spaces Deployment2 3This guide explains how to deploy the Knowledge Graph Extraction app to Hugging Face Spaces using the provided Dockerfile.4 5## Deployment Steps6 7### 1. Create a New Space81. Go to [Hugging Face Spaces](https://huggingface.co/spaces)92. Click "Create new Space"103. Choose a name for your space114. Select "Docker" as the SDK125. Choose "Public" or "Private" visibility13 14### 2. Upload Files15Upload all the project files to your space, including:16- `Dockerfile`17- `app_streamlit.py`18- `requirements.txt`19- `src/` directory with all modules20- `config/` directory21- `.env.example` (optional)22 23### 3. Environment Variables24In your Hugging Face Space settings, add the following environment variable:25- `OPENROUTER_API_KEY`: Your OpenRouter API key (optional, users can also input it in the app)26 27### 4. Docker Configuration28The Dockerfile is already optimized for HF Spaces with:29- Port 7860 (HF Spaces standard)30- Proper system dependencies for PDF processing31- Streamlit configured for headless deployment32- Health checks enabled33 34### 5. App Features35Once deployed, users can:36- Upload PDF, TXT, DOCX, or JSON documents37- Enter their OpenRouter API key in the sidebar38- Extract knowledge graphs using LLM processing39- Visualize graphs with various layout options40- Filter entities by type and importance41- Export graphs in JSON, GraphML, or GEXF formats42 43## Technical Details44 45### Dependencies46The Dockerfile installs:47- System packages: `poppler-utils`, `libpoppler-cpp-dev` for PDF processing48- Python packages: All from `requirements.txt`49 50### File Limits51- Default Streamlit file upload limit: 200MB52- Recommended per-file limit in config: 10MB53 54### Models Used55- Primary: `qwen/qwen3-32b` (free model via OpenRouter)56- The app uses cost-effective models to minimize API costs57 58## Usage Notes59- Users need their own OpenRouter API key60- Processing time depends on document size and complexity61- The app supports batch processing of multiple documents62- Temporary files are automatically cleaned up after processing63 64## Troubleshooting65If deployment fails:661. Check that all files are uploaded correctly672. Verify the Dockerfile syntax683. Check HF Spaces logs for specific error messages694. Ensure requirements.txt contains all necessary dependencies70