Spaces:
Sleeping
Sleeping
| """ | |
| Social Pill - AI Backend | |
| Stack: FastAPI + Groq (LLaMA3) + YouTube API + Reddit + Google Trends | |
| """ | |
| from fastapi import FastAPI, HTTPException, BackgroundTasks | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from pydantic import BaseModel | |
| from typing import Optional | |
| import asyncio | |
| import uvicorn | |
| from routes import youtube_router, scout_router, coach_router, identity_router, assistant_router | |
| app = FastAPI( | |
| title="Social Pill API", | |
| description="AI-powered backend for YouTube creator growth", | |
| version="1.0.0" | |
| ) | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=["*"], # Lock this down in production | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| # Mount routers | |
| app.include_router(identity_router, prefix="/api/identity", tags=["Channel DNA"]) | |
| app.include_router(scout_router, prefix="/api/scout", tags=["Topic Scout"]) | |
| app.include_router(coach_router, prefix="/api/coach", tags=["AI Coach"]) | |
| app.include_router(youtube_router, prefix="/api/youtube", tags=["YouTube Data"]) | |
| app.include_router(assistant_router, prefix="/api/assistant", tags=["Help Chatbot"]) | |
| async def root(): | |
| return { | |
| "product": "Social Pill", | |
| "status": "online", | |
| "version": "1.0.0", | |
| "endpoints": ["/api/identity", "/api/scout", "/api/coach", "/api/youtube", "/api/assistant"] | |
| } | |
| async def health(): | |
| return {"status": "healthy"} | |
| if __name__ == "__main__": | |
| uvicorn.run("main:app", host="0.0.0.0", port=8080, reload=True) |