Yassine Mhirsi
Update configuration for stance detection model by renaming environment variables and adjusting model loading in main.py
70a2026
raw
history blame
1.16 kB
"""Configuration settings for the API"""
import os
from pathlib import Path
from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
# Get project root directory
API_DIR = Path(__file__).parent
PROJECT_ROOT = API_DIR.parent
# Hugging Face configuration
HUGGINGFACE_API_KEY = os.getenv("HUGGINGFACE_API_KEY", "")
HUGGINGFACE_STANCE_MODEL_ID = os.getenv("HUGGINGFACE_STANCE_MODEL_ID", "yassine-mhirsi/debertav3-stance-detection")
# Stance detection model configuration
# Use Hugging Face model ID instead of local path
STANCE_MODEL_ID = HUGGINGFACE_STANCE_MODEL_ID
# API configuration
API_TITLE = "NLP Project API"
API_DESCRIPTION = "API for various NLP models including stance detection and more"
API_VERSION = "1.0.0"
# Server configuration
HOST = os.getenv("HOST", "0.0.0.0") # Use 0.0.0.0 for Docker/Spaces
PORT = int(os.getenv("PORT", "7860")) # Default 7860 for Hugging Face Spaces
RELOAD = os.getenv("RELOAD", "False").lower() == "true" # Set to False in production
# CORS configuration
CORS_ORIGINS = ["*"] # In production, specify exact origins
CORS_CREDENTIALS = True
CORS_METHODS = ["*"]
CORS_HEADERS = ["*"]