Update app.py
Browse files
app.py
CHANGED
|
@@ -512,6 +512,20 @@ def process_reports():
|
|
| 512 |
logger.exception("Node pipeline failed")
|
| 513 |
return jsonify({"error": "Node pipeline failed", "detail": str(e)}), 500
|
| 514 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 515 |
@app.route("/upload_reports", methods=["POST"])
|
| 516 |
def upload_reports():
|
| 517 |
"""
|
|
|
|
| 512 |
logger.exception("Node pipeline failed")
|
| 513 |
return jsonify({"error": "Node pipeline failed", "detail": str(e)}), 500
|
| 514 |
|
| 515 |
+
|
| 516 |
+
import mimetypes
|
| 517 |
+
import requests
|
| 518 |
+
import contextlib
|
| 519 |
+
from pathlib import Path
|
| 520 |
+
|
| 521 |
+
# configurable remote target (change headers/auth as needed)
|
| 522 |
+
REMOTE_UPLOAD_URL = "https://webashalarforml-health-dac-assist.hf.space/upload_reports"
|
| 523 |
+
REMOTE_UPLOAD_HEADERS = {
|
| 524 |
+
# optional headers used by your curl example; update/remove as required
|
| 525 |
+
"Origin": "https://webashalarforml-health-dac-assist.hf.space",
|
| 526 |
+
"Accept": "*/*",
|
| 527 |
+
"User-Agent": "HealthReportsUploader/1.0"
|
| 528 |
+
|
| 529 |
@app.route("/upload_reports", methods=["POST"])
|
| 530 |
def upload_reports():
|
| 531 |
"""
|