HyraXuna commited on
Commit
4c52175
Β·
verified Β·
1 Parent(s): 0e84f47

Upload 2 files

Browse files
Files changed (2) hide show
  1. Dockerfile +5 -2
  2. app.py +7 -5
Dockerfile CHANGED
@@ -19,12 +19,15 @@ ENV HOME=/home/user \
19
  # We set working directory to $HOME/app (<=> /home/user/app)
20
  WORKDIR $HOME/app
21
 
22
- COPY requirements.txt /dependencies/requirements.txt
23
- RUN pip install -r /dependencies/requirements.txt
 
24
  # Copy all local files to /home/user/app with "user" as owner of these files
25
  # Always use --chown=user when using HUGGINGFACE to avoid permission errors
26
  COPY --chown=user . $HOME/app
27
 
 
 
28
 
29
  COPY . $HOME/app
30
 
 
19
  # We set working directory to $HOME/app (<=> /home/user/app)
20
  WORKDIR $HOME/app
21
 
22
+ # Install basic dependencies
23
+ RUN pip install boto3 pandas gunicorn streamlit scikit-learn matplotlib seaborn plotly
24
+
25
  # Copy all local files to /home/user/app with "user" as owner of these files
26
  # Always use --chown=user when using HUGGINGFACE to avoid permission errors
27
  COPY --chown=user . $HOME/app
28
 
29
+ COPY requirements.txt /dependencies/requirements.txt
30
+ RUN pip install -r /dependencies/requirements.txt
31
 
32
  COPY . $HOME/app
33
 
app.py CHANGED
@@ -7,11 +7,13 @@ from fastapi import FastAPI, File, UploadFile
7
  import joblib
8
  from fastapi.responses import RedirectResponse
9
 
10
- # Log model from mlflow
11
- logged_model = 'runs:/c2037b0c2c9e4c629a02b7b8a7eb2642/model'
12
-
13
- # Load model as a PyFuncModel.
14
- loaded_model = mlflow.pyfunc.load_model(logged_model)
 
 
15
 
16
  description = """
17
  Welcome to the rental price predictor API for Getaround 🏎️ !\n
 
7
  import joblib
8
  from fastapi.responses import RedirectResponse
9
 
10
+ try:
11
+ logged_model = 'runs:/c2037b0c2c9e4c629a02b7b8a7eb2642/model'
12
+ loaded_model = mlflow.pyfunc.load_model(logged_model)
13
+ print("βœ… Model loaded successfully!")
14
+ except Exception as e:
15
+ print(f"❌ Error loading model: {e}")
16
+ loaded_model = None
17
 
18
  description = """
19
  Welcome to the rental price predictor API for Getaround 🏎️ !\n