from fastapi import FastAPI app = FastAPI() @app.post("/fine-tune") def fine_tune_model(): import subprocess result = subprocess.run(["python", "fine_tune.py"], capture_output=True, text=True) if result.returncode == 0: return {"status": "Fine-tuning completed successfully!", "logs": result.stdout} else: raise HTTPException(status_code=500, detail=f"Error during fine-tuning: {result.stderr}")