Spaces:
Sleeping
Sleeping
| from fastapi import FastAPI | |
| from routes import router as api_router | |
| # Initialize the FastAPI app | |
| app = FastAPI( | |
| title="Real vs. Fake Image Classification API", | |
| description="An API to classify images as real or fake using OpenAI's CLIP and an SVM model.", | |
| version="1.0.0" | |
| ) | |
| # Include the API router | |
| # All routes defined in routes.py will be available under the /api prefix | |
| app.include_router(api_router, prefix="/api", tags=["Classification"]) | |
| async def read_root(): | |
| """ | |
| A simple root endpoint to confirm the API is running. | |
| """ | |
| return {"message": "Welcome to the Image Classification API. Go to /docs for the API documentation."} | |
| # To run this application: | |
| # 1. Make sure you have all dependencies from requirements.txt installed. | |
| # 2. Make sure the 'svm_model.joblib' file is in the same directory. | |
| # 3. Run the following command in your terminal: | |
| # uvicorn main:app --reload | |