A powerful interactive knowledge graph system that transforms documents into queryable knowledge networks with natural language Q&A capabilities.
- Document Processing: Upload TXT files and process web URLs
- Interactive Visualization: D3.js-powered graph with drag, zoom, and pan
- Entity Recognition: Automatic extraction of people, organizations, locations, products
- Relationship Mapping: Discover connections between entities
- Natural Language Q&A: Ask questions about your knowledge graph
- Real-time Analytics: Live statistics and updates
- Google Cloud Account: Create one here
- Google Cloud SDK: Install gcloud CLI
- Docker (optional): For local testing
# Create a new project (optional)
gcloud projects create your-project-id --name="Knowledge Graph Explorer"
# Set your project ID
gcloud config set project your-project-id
# Enable billing (required for Cloud Run)
# Visit: https://console.cloud.google.com/billing# Edit deploy.sh and set your PROJECT_ID
nano deploy.sh
# Run the deployment script
./deploy.shThat's it! Your Knowledge Graph Explorer will be live in minutes.
If you prefer manual control:
gcloud services enable cloudbuild.googleapis.com
gcloud services enable run.googleapis.com
gcloud services enable containerregistry.googleapis.com# Build the container
gcloud builds submit --tag gcr.io/YOUR_PROJECT_ID/knowledge-graph-explorer
# Deploy to Cloud Run
gcloud run deploy knowledge-graph-explorer \
--image gcr.io/YOUR_PROJECT_ID/knowledge-graph-explorer \
--region us-central1 \
--platform managed \
--allow-unauthenticated \
--memory 2Gi \
--cpu 1 \
--max-instances 10 \
--port 8080βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β React Frontendβ β Flask Backend β β spaCy NLP β
β - D3.js Graph βββββΊβ - REST API βββββΊβ - Entity Ext. β
β - File Upload β β - CORS Enabled β β - Relationshipsβ
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Static Assets β β SQLite DB β β Knowledge Graphβ
β - HTML/CSS/JS β β - Documents β β - Nodes/Edges β
β - Images β β - Entities β β - Relationshipsβ
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
Create a .env file (copy from .env.example):
SECRET_KEY=your-super-secret-key-here
FLASK_ENV=production
DATABASE_URL=postgresql://user:pass@host:port/db # Optional
MAX_CONTENT_LENGTH=104857600 # 100MB- β CORS properly configured
- β File upload size limits
- β Non-root container user
- β Environment-based configuration
- β Production-ready Gunicorn server
- Auto-scaling: 0 to 10 instances based on traffic
- Pay-per-use: Only charged when processing requests
- Health checks: Automatic restart on failures
- HTTPS: SSL certificate included
- Global CDN: Fast worldwide access
# View logs
gcloud run services logs read knowledge-graph-explorer --region=us-central1
# Monitor metrics
gcloud run services describe knowledge-graph-explorer --region=us-central1# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Download spaCy model
python -m spacy download en_core_web_sm
# Run locally
python src/main.py# Build image
docker build -t knowledge-graph-explorer .
# Run container
docker run -p 8080:8080 knowledge-graph-explorer- Drag and drop TXT files
- Maximum 100MB total across all documents
- Automatic entity extraction and relationship mapping
- Enter web page URLs
- Content extraction and processing
- Integration with existing knowledge graph
- "What companies does Elon Musk lead?"
- "How is Tesla connected to SpaceX?"
- "What locations are mentioned in the documents?"
- Drag nodes to reorganize the graph
- Zoom and pan for detailed exploration
- Hover for entity information
- Color-coded entity types
Google Cloud Run pricing (as of 2024):
- CPU: $0.00002400 per vCPU-second
- Memory: $0.00000250 per GiB-second
- Requests: $0.40 per million requests
- Free tier: 2 million requests/month
Estimated monthly cost for moderate usage: $5-20
# Make your changes
git add .
git commit -m "Update application"
# Redeploy
./deploy.sh# Export SQLite database (if using default storage)
gcloud run services proxy knowledge-graph-explorer --port=8080
# Then use database export tools-
Build Failures
- Check Docker syntax in Dockerfile
- Verify all dependencies in requirements.txt
-
Memory Issues
- Increase memory allocation in cloudbuild.yaml
- Optimize spaCy model usage
-
Permission Errors
- Ensure proper IAM roles
- Check service account permissions
- Google Cloud Support: Cloud Console
- Documentation: Cloud Run Docs
- Community: Stack Overflow
This project is open source and available under the MIT License.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Built with β€οΈ using Flask, React, D3.js, and spaCy