Yash goyal commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -238,7 +238,8 @@ def training_plot():
|
|
| 238 |
|
| 239 |
@app.route("/uploads/<filename>")
|
| 240 |
def uploaded_file(filename):
|
| 241 |
-
|
|
|
|
| 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 |
-
|
| 273 |
-
os.
|
|
|
|
| 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 |
|