BackendServer / README.md
Codegeass321's picture
HF Spaces
8bf7eee
|
raw
history blame
1.51 kB
metadata
title: ChatDocxAI
emoji: πŸ“„
colorFrom: indigo
colorTo: blue
sdk: gradio
sdk_version: 4.19.2
app_file: app.py
pinned: false

Backend (FastAPI with Gradio UI)

Structure

  • api.py β€” Main FastAPI app
  • app.py β€” Gradio wrapper for FastAPI
  • utils.py β€” Helper functions
  • requirements.txt β€” Python dependencies
  • .env.example β€” Example environment variables

Port Configuration

  • FastAPI: Port 8000 (internal)
  • Gradio: Port 7860 (default for Hugging Face Spaces)

API Endpoints

  • Upload Documents: https://codegeass321-backendserver-8000.hf.space/upload
  • Ask Questions: https://codegeass321-backendserver-8000.hf.space/ask
  • Check Status: https://codegeass321-backendserver-8000.hf.space/status
  • API Documentation: https://codegeass321-backendserver-8000.hf.space/docs

Running Locally

pip install -r requirements.txt
python app.py

Deploying to Hugging Face Spaces

  1. Create a new Space with Gradio SDK
  2. Upload this repository to the Space
  3. Set the following environment variables in the Space settings:
    • GOOGLE_API_KEY - Your Google Gemini API key
    • SUPABASE_URL - Your Supabase URL
    • SUPABASE_KEY - Your Supabase API key

For Render (Legacy)

  • Use the following start command on Render:
    uvicorn api:app --host 0.0.0.0 --port 10000
    
    
    
  • Add your environment variables in the Render dashboard

Do not commit your real .env file! Use .env.example for reference.