gokstad commited on
Commit
82f1c9d
·
verified ·
1 Parent(s): 66a209b

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +8 -3
  2. dockerfile +2 -3
app.py CHANGED
@@ -2,6 +2,11 @@ from fastapi import FastAPI
2
 
3
  app = FastAPI()
4
 
5
- @app.get("/")
6
- def read_root():
7
- return {"message": "Fine-tuning script is running"}
 
 
 
 
 
 
2
 
3
  app = FastAPI()
4
 
5
+ @app.post("/fine-tune")
6
+ def fine_tune_model():
7
+ import subprocess
8
+ result = subprocess.run(["python", "fine_tune.py"], capture_output=True, text=True)
9
+ if result.returncode == 0:
10
+ return {"status": "Fine-tuning completed successfully!", "logs": result.stdout}
11
+ else:
12
+ raise HTTPException(status_code=500, detail=f"Error during fine-tuning: {result.stderr}")
dockerfile CHANGED
@@ -19,9 +19,8 @@ RUN pip install --no-cache-dir --upgrade pip && \
19
  # Copy the application files
20
  COPY . .
21
 
22
- # Expose the port your app runs on (7860 is the default for Spaces)
23
  EXPOSE 7860
24
 
25
- # Command to start the FastAPI app
26
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
27
-
 
19
  # Copy the application files
20
  COPY . .
21
 
22
+ # Expose the port your app runs on
23
  EXPOSE 7860
24
 
25
+ # Command to start the Python fine-tuning script
26
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]