Spaces:
Sleeping
Sleeping
Deploy SaulGPT backend with full ChromaDB, Supabase, and Gradio API server
Browse files- app.py +10 -0
- requirements.txt +26 -30
app.py
CHANGED
|
@@ -21,6 +21,16 @@ if BACKEND_DIR not in sys.path:
|
|
| 21 |
from dotenv import load_dotenv
|
| 22 |
load_dotenv(os.path.join(BASE_DIR, ".env"))
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
# Import the production FastAPI application
|
| 25 |
from api_server import app as fastapi_app
|
| 26 |
import gradio as gr
|
|
|
|
| 21 |
from dotenv import load_dotenv
|
| 22 |
load_dotenv(os.path.join(BASE_DIR, ".env"))
|
| 23 |
|
| 24 |
+
# Ensure spacy model is available
|
| 25 |
+
import subprocess
|
| 26 |
+
try:
|
| 27 |
+
import spacy
|
| 28 |
+
if not spacy.util.is_package("en_core_web_sm"):
|
| 29 |
+
print("Downloading en_core_web_sm...")
|
| 30 |
+
subprocess.run([sys.executable, "-m", "spacy", "download", "en_core_web_sm"], check=False)
|
| 31 |
+
except Exception as _e:
|
| 32 |
+
print(f"spaCy init check: {_e}")
|
| 33 |
+
|
| 34 |
# Import the production FastAPI application
|
| 35 |
from api_server import app as fastapi_app
|
| 36 |
import gradio as gr
|
requirements.txt
CHANGED
|
@@ -1,43 +1,39 @@
|
|
| 1 |
# SaulGPT Backend Dependencies for Hugging Face Spaces
|
| 2 |
-
fastapi=
|
| 3 |
-
uvicorn=
|
| 4 |
-
pydantic=
|
| 5 |
-
python-multipart=
|
| 6 |
-
gradio==4.44.0
|
| 7 |
|
| 8 |
-
# Web scraping
|
| 9 |
-
requests=
|
| 10 |
-
beautifulsoup4=
|
| 11 |
-
lxml=
|
| 12 |
-
duckduckgo-search=
|
| 13 |
|
| 14 |
-
#
|
| 15 |
sentence-transformers>=2.7.0
|
| 16 |
-
chromadb=
|
| 17 |
-
spacy=
|
| 18 |
-
langdetect=
|
| 19 |
-
langchain=
|
| 20 |
-
langchain-groq=
|
| 21 |
-
langchain-core=
|
| 22 |
groq>=0.9.0
|
| 23 |
-
networkx=
|
| 24 |
-
rank-bm25=
|
| 25 |
-
tqdm=
|
| 26 |
|
| 27 |
# Document processing
|
| 28 |
-
PyMuPDF=
|
| 29 |
-
python-docx=
|
| 30 |
reportlab>=3.6.0
|
| 31 |
|
| 32 |
# Scheduling & Environment
|
| 33 |
-
apscheduler=
|
| 34 |
-
python-dotenv=
|
| 35 |
|
| 36 |
# Authentication & Database
|
| 37 |
-
passlib=
|
| 38 |
-
bcrypt=
|
| 39 |
-
python-jose[cryptography]=
|
| 40 |
psycopg2-binary>=2.9.9
|
| 41 |
-
|
| 42 |
-
# NLP model
|
| 43 |
-
en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.7.0/en_core_web_sm-3.7.0-py3-none-any.whl
|
|
|
|
| 1 |
# SaulGPT Backend Dependencies for Hugging Face Spaces
|
| 2 |
+
fastapi>=0.104.0
|
| 3 |
+
uvicorn>=0.24.0
|
| 4 |
+
pydantic>=2.5.0
|
| 5 |
+
python-multipart>=0.0.6
|
|
|
|
| 6 |
|
| 7 |
+
# Web scraping & Search
|
| 8 |
+
requests>=2.31.0
|
| 9 |
+
beautifulsoup4>=4.12.2
|
| 10 |
+
lxml>=4.9.3
|
| 11 |
+
duckduckgo-search>=3.9.8
|
| 12 |
|
| 13 |
+
# AI & Retrieval
|
| 14 |
sentence-transformers>=2.7.0
|
| 15 |
+
chromadb>=0.4.18
|
| 16 |
+
spacy>=3.7.2
|
| 17 |
+
langdetect>=1.0.9
|
| 18 |
+
langchain>=0.1.0
|
| 19 |
+
langchain-groq>=0.1.0
|
| 20 |
+
langchain-core>=0.1.10
|
| 21 |
groq>=0.9.0
|
| 22 |
+
networkx>=3.2.1
|
| 23 |
+
rank-bm25>=0.2.2
|
| 24 |
+
tqdm>=4.66.1
|
| 25 |
|
| 26 |
# Document processing
|
| 27 |
+
PyMuPDF>=1.23.8
|
| 28 |
+
python-docx>=1.1.0
|
| 29 |
reportlab>=3.6.0
|
| 30 |
|
| 31 |
# Scheduling & Environment
|
| 32 |
+
apscheduler>=3.10.4
|
| 33 |
+
python-dotenv>=1.0.0
|
| 34 |
|
| 35 |
# Authentication & Database
|
| 36 |
+
passlib>=1.7.4
|
| 37 |
+
bcrypt>=4.0.1
|
| 38 |
+
python-jose[cryptography]>=3.3.0
|
| 39 |
psycopg2-binary>=2.9.9
|
|
|
|
|
|
|
|
|