Spaces:
Sleeping
Sleeping
|
Download RunAPI.md from winsweb/teleprocessinggh: direct link, hf CLI and curl.
- Browser
- Download file 2.57 kB
-
https://huggingface.co/spaces/winsweb/teleprocessinggh/resolve/main/RunAPI.md
- Command line
-
hf download hf://spaces/winsweb/teleprocessinggh/RunAPI.md
-
curl -L -o RunAPI.md https://huggingface.co/spaces/winsweb/teleprocessinggh/resolve/main/RunAPI.md
2.57 kB
Deployment & API Guide
This guide explains how to push your code to GitHub and deploy the API so you can access the Swagger UI.
1. Push to GitHub
Initialize Git (if not already done):
git init git add . git commit -m "Initial commit: Joined PDF/CSV API with Docker support"Create a Repository on GitHub (e.g.,
telecom-anomaly-detection).Link and Push:
git remote add origin https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git git branch -M main git push -u origin main
2. Deploying to Vercel (Serverless)
Vercel is primarily for frontend, but you can run the FastAPI backend using their Python runtime.
- Install Vercel CLI:
npm i -g vercel - Login:
vercel login - Deploy: Run
vercelin the project root. - Access Swagger: Once deployed, go to
https://your-project-name.vercel.app/docs.
⚠️ Note: If the PDF processing fails on Vercel due to "Java not found", you MUST use the Docker method below.
3. Recommended: Deploying with Docker (Railway / Render)
Since your project requires Java (for tabula-py), using a platform that supports your Dockerfile is much more reliable.
Option A: Railway.app (Easiest)
- Go to Railway.app and login with GitHub.
- Click New Project -> Deploy from GitHub repo.
- Select your repository.
- Railway will see your
Dockerfileand deploy it automatically. - Your Swagger UI will be at:
https://your-railway-url.up.railway.app/docs.
Option B: Render.com
- Go to Render.com.
- Click New -> Web Service.
- Connect your GitHub and select the repo.
- Select Environment: Docker.
- Click Deploy.
- Your Swagger UI will be at:
https://your-subdomain.onrender.com/docs.
4. Accessing Swagger UI Locally
To test everything locally before pushing:
- Run with Uvicorn:
uvicorn telecom_anomaly.api:app --reload - Open Browser:
- Interactive Documentation (Swagger): http://127.0.0.1:8000/docs
- Alternative Docs (Redoc): http://127.0.0.1:8000/redoc
5. Using the Unified Endpoint
- Endpoint:
POST /analyze - Function: Upload a PDF (or CSV).
- Parameters:
save_results: Set totrueif you want to save files on the server (Docker only).filter_movements: Set totrueto clean up geographic data.- All other settings match your original logic.