Yash goyal commited on
Commit
eedbea1
·
verified ·
1 Parent(s): 762090d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -238,7 +238,8 @@ def training_plot():
238
 
239
  @app.route("/uploads/<filename>")
240
  def uploaded_file(filename):
241
- return send_file(os.path.join("static/uploads", filename))
 
242
 
243
  @app.route("/predict", methods=["POST"])
244
  def predict():
@@ -269,8 +270,9 @@ def predict():
269
 
270
  timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
271
  image_filename = f"scan_{user.id}_{timestamp}.jpg"
272
- image_path = os.path.join("static/uploads", image_filename)
273
- os.makedirs("static/uploads", exist_ok=True)
 
274
  with open(image_path, "wb") as f:
275
  f.write(image_bytes)
276
 
 
238
 
239
  @app.route("/uploads/<filename>")
240
  def uploaded_file(filename):
241
+ upload_folder = "/tmp/uploads"
242
+ return send_file(os.path.join(upload_folder, filename))
243
 
244
  @app.route("/predict", methods=["POST"])
245
  def predict():
 
270
 
271
  timestamp = datetime.now().strftime("%Y%m%d%H%M%S")
272
  image_filename = f"scan_{user.id}_{timestamp}.jpg"
273
+ upload_folder = "/tmp/uploads"
274
+ image_path = os.path.join(upload_folder, image_filename)
275
+ os.makedirs(upload_folder, exist_ok=True)
276
  with open(image_path, "wb") as f:
277
  f.write(image_bytes)
278