from main import generate_aggregated_summary # Add this import at the top of your file # Endpoint for your primary model from main.py @app.post("/predict/main_model") async def predict_with_main_model(payload: TextInput): """ Processes input text using the primary model from main.py. """ if not payload.text: raise HTTPException(status_code=400, detail="Text input cannot be empty.") try: # CORRECTED: Pass the string directly to your function prediction = generate_aggregated_summary(payload.text) return {"model": "main", "prediction": prediction} except Exception as e: # Return an error if the model fails raise HTTPException(status_code=500, detail=str(e))