diff --git a/app.py b/app.py
index 9f27aa0..d75f6e0 100644
--- a/app.py
+++ b/app.py
@@ -321,12 +321,27 @@ def _poll_result(endpoint: str, request_id: str) -> Response:
result = request_store.get_result(request_id)
if result is None:
return jsonify({"status": "complete", "success": False, "error": "Result not found"}), 500
- return jsonify({
+ fmt = result.get("format", "markdown")
+ payload = {
"status": "complete",
"success": result.get("success", False),
"error": result.get("error"),
- **{k: v for k, v in result.items() if k not in ("success", "error")},
- })
+ "output_format": fmt,
+ }
+ output_text = result.get("output", "")
+ if fmt in ("markdown", "html"):
+ payload[fmt] = output_text
+ elif fmt == "json":
+ try:
+ payload["json"] = json.loads(output_text) if output_text else None
+ except (json.JSONDecodeError, TypeError):
+ payload["json"] = output_text
+ elif fmt == "chunks":
+ payload["chunks"] = output_text
+ payload["images"] = result.get("images_b64", {})
+ payload["metadata"] = result.get("metadata", {})
+ payload["page_count"] = result.get("page_count")
+ return jsonify(payload)
# ── Flask app factory ────────────────────────────────────────────────
@@ -756,14 +771,21 @@ code{background:#f4f4f4;padding:2px 6px;border-radius:3px}
data = request.get_json() if request.is_json else {}
filename = data.get("filename", "file")
content_type = data.get("content_type", "application/octet-stream")
+ import time as tmod
file_id = str(uuid.uuid4())
file_dir = _file_storage_path() / file_id
file_dir.mkdir(parents=True, exist_ok=True)
metadata = {
"file_id": file_id,
+ "original_filename": filename,
"filename": filename,
"content_type": content_type,
+ "reference": f"datalab://file-{file_id}",
"created_at": time.time(),
+ "created": tmod.strftime("%Y-%m-%dT%H:%M:%SZ", tmod.gmtime()),
+ "file_size": None,
+ "upload_status": "pending",
+ "error": None,
}
(file_dir / "metadata.json").write_text(json.dumps(metadata))
import secrets
@@ -785,9 +807,11 @@ code{background:#f4f4f4;padding:2px 6px;border-radius:3px}
(file_dir / "content").write_bytes(request.data)
metadata_path = file_dir / "metadata.json"
if metadata_path.exists():
+ import time as tmod
meta = json.loads(metadata_path.read_text())
- meta["uploaded_at"] = time.time()
- meta["size"] = len(request.data)
+ meta["uploaded_at"] = tmod.time()
+ meta["file_size"] = len(request.data)
+ meta["upload_status"] = "completed"
metadata_path.write_text(json.dumps(meta))
return jsonify({"success": True})
diff --git a/enisa-international-strategy-2026.pdf b/enisa-international-strategy-2026.pdf
deleted file mode 100644
index b98c14a..0000000
--- a/enisa-international-strategy-2026.pdf
+++ /dev/null
@@ -1,974 +0,0 @@
-
-
-
- Sorry - 821436
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- bg
-
-
-
- Сървърът е временно недостъпен
-
-
- Извиняваме се за неудобството. Моля, опитайте пак по-късно.
-
-
-
-
-
-
- cs
-
-
-
- Server je dočasně nedostupný
-
-
- Omlouváme se za způsobené nepříjemnosti. Zkuste to prosím znovu později.
-
-
-
-
-
-
- da
-
-
-
- Serveren er midlertidigt utilgængelig
-
-
- Vi undskylder ulejligheden. Prøv igen senere.
-
-
-
-
-
-
- de
-
-
-
- Der Server ist vorübergehend nicht verfügbar
-
-
- Wir entschuldigen uns für etwaige Unannehmlichkeiten. Bitte
- versuchen Sie es später noch einmal.
-
-
-
-
-
-
- el
-
-
-
- Ο διακομιστής δεν είναι διαθέσιμος προσωρινά
-
-
- Ζητούμε συγγνώμη για τυχόν προβλήματα. Δοκιμάστε ξανά αργότερα.
-
-
-
-
-
-
- en
-
-
-
- The server is temporarily unavailable
-
-
- We apologise for any inconvenience. Please try again later.
-
-
-
-
-
-
- es
-
-
-
- El servidor no está disponible temporalmente
-
-
- Le rogamos disculpe las molestias. Vuelva a intentarlo más
- tarde.
-
-
-
-
-
-
- et
-
-
-
- Server ei ole ajutiselt kättesaadav
-
-
- Palume vabandust tekkinud ebamugavuste pärast. Palun proovige
- hiljem uuesti.
-
-
-
-
-
-
- fi
-
-
-
- Palvelin on väliaikaisesti poissa käytöstä
-
-
- Pahoittelemme mahdollista haittaa. Yritä myöhemmin uudelleen.
-
-
-
-
-
-
- fr
-
-
-
- Le serveur est temporairement indisponible
-
-
- Veuillez nous excuser pour ce désagrément. Merci de réessayer
- plus tard.
-
-
-
-
-
-
- ga
-
-
-
- Níl fáil ar an bhfreastalaí i láthair na huaire
-
-
- Is oth linn an chiotaí. Bain triail as arís ar ball.
-
-
-
-
-
-
- hr
-
-
-
- Poslužitelj je privremeno nedostupan
-
-
- Ispričavamo se zbog neugodnosti. Pokušajte ponovno kasnije.
-
-
-
-
-
-
-
-
- hu
-
-
-
- A szerver átmenetileg nem érhető el, kérjük, próbálkozzon újra
- később
-
-
- Az esetleges kellemetlenségekért elnézését kérjük.
-
-
-
-
-
-
- it
-
-
-
- Il server è temporaneamente non disponibile
-
-
- Ci scusiamo per il disagio arrecato. Riprovare più tardi.
-
-
-
-
-
-
- lt
-
-
-
- Serveris laikinai neveikia
-
-
- Atsiprašome už nepatogumus. Bandykite dar kartą vėliau.
-
-
-
-
-
-
- lv
-
-
-
- Serveris pagaidām nav pieejams
-
-
- Atvainojamies par neērtībām. Mēģiniet vēlreiz vēlāk.
-
-
-
-
-
-
- mt
-
-
-
- Is-server mhux disponibbli temporanjament
-
-
- Niskużaw ruħna għal kwalunkwe inkonvenjenza. Jekk jogħġbok erġa’
- pprova aktar tard.
-
-
-
-
-
-
- nl
-
-
-
- De server is tijdelijk niet beschikbaar
-
-
- Onze excuses voor het ongemak. Probeer het later nog een keer.
-
-
-
-
-
-
- pl
-
-
-
- Serwer jest tymczasowo niedostępny
-
-
- Przepraszamy za wszelkie niedogodności. Proszę spróbować
- później.
-
-
-
-
-
-
- pt
-
-
-
- O servidor está temporariamente indisponível
-
-
- Pedimos desculpa pelo incómodo. Volte a tentar mais tarde.
-
-
-
-
-
-
- ro
-
-
-
- Serverul este temporar indisponibil
-
-
- Ne cerem scuze pentru eventualele inconveniente. Vă rugăm să
- reîncercați mai târziu.
-
-
-
-
-
-
- sk
-
-
-
- Server je dočasne nedostupný
-
-
- Ospravedlňujeme sa za prípadné problémy, ktoré môžu v dôsledku
- toho vzniknúť.
-
-
-
-
-
-
- sl
-
-
-
- Strežnik je začasno nedosegljiv
-
-
- Opravičujemo se za morebitne nevšečnosti. Poskusite ponovno
- pozneje.
-
-
-
-
-
-
- sv
-
-
-
- Servern är inte tillgänglig för tillfället
-
-
- Vi ber om ursäkt för besväret. Försök igen senare.
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/enisa-stakeholder-strategy-2026-2028.pdf b/enisa-stakeholder-strategy-2026-2028.pdf
deleted file mode 100644
index 2640bc4..0000000
--- a/enisa-stakeholder-strategy-2026-2028.pdf
+++ /dev/null
@@ -1,683 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page not found | ENISA
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Page not found
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
OOPS! PAGE NOT FOUND
-
The page you are looking for can't be found.
-
Go to the homepage
-
-
-
-
-
-
-
-
-
-
-
-
-
Subscribe
-
Stay updated with ENISA! Sign up for email alerts on publications, events, vacancies,
- and more.
-
Sign up now
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test_report_20260604_105707.md b/test_report_20260604_105707.md
deleted file mode 100644
index 2227bef..0000000
--- a/test_report_20260604_105707.md
+++ /dev/null
@@ -1,58 +0,0 @@
-# Test Report — marker-api Endpoint Tests
-
-**Date:** 2026-06-04 10:57:07
-**API Base:** N/A (offline validation)
-**Test files:** /home/oval/Projects/marker-api/test_files/enisa (5 file(s))
-
-## Summary
-
-| Result | Count |
-|--------|-------|
-| ✅ Passed | 5 |
-| ❌ Failed | 0 |
-| ⏭️ Skipped | 10 |
-| **Total** | **15** |
-| **Pass Rate** | **33.3%** |
-
-## Test Details
-
-| Test | Result | Time | Notes |
-|------|--------|------|-------|
-
-### Application Tests
-| app.py syntax valid | ✅ PASS | 0.002s | |
-| use_llm/llm_service params present in app.py | ✅ PASS | 0.000s | |
-| marker-convert.ps1 has all new parameters | ✅ PASS | 0.000s | |
-| README.md documents all endpoints | ✅ PASS | 0.000s | |
-| ENISA test files available | ✅ PASS | 0.019s | |
-
-### Endpoint Tests (HTTP)
-| GET /health | ⏭️ SKIP | - | API not running |
-| GET / | ⏭️ SKIP | - | API not running |
-| POST /marker (multipart) | ⏭️ SKIP | - | API not running |
-| POST /marker (JSON) | ⏭️ SKIP | - | API not running |
-| POST /marker with use_llm | ⏭️ SKIP | - | API not running |
-| POST /marker with page_range | ⏭️ SKIP | - | API not running |
-| POST /marker missing file | ⏭️ SKIP | - | API not running |
-| POST /v1/conversions | ⏭️ SKIP | - | API not running |
-| POST /v1/files/convert (multipart) | ⏭️ SKIP | - | API not running |
-| POST /v1/files/convert (JSON) | ⏭️ SKIP | - | API not running |
-
-## Environment
-- Python: 3.14.5
-- Platform: linux
-- marker: ❌ not installed (Pillow build failure on this platform)
-
-## Test Files
-- enisa-international-strategy-2026.pdf (39.7 KB)
-- enisa-nis360-2026.pdf (3983.3 KB)
-- enisa-stakeholder-strategy-2026-2028.pdf (35.3 KB)
-- nis-investments-2025.pdf (3118.9 KB)
-- nis2-technical-implementation-guidance.pdf (4699.7 KB)
-
-## Notes
-- HTTP endpoint tests require a running marker-api instance.
-- API-level tests were skipped (no API running).
-- Offline validation tests (syntax, parameter availability, docs) ran regardless.
-- The marker library could not be installed due to Pillow build failure in this sandbox.
-- For live endpoint testing, start the API with: `python app.py` (requires marker-pdf[full] + flask).
diff --git a/test_report_20260604_131933.md b/test_report_20260604_131933.md
deleted file mode 100644
index 05332a0..0000000
--- a/test_report_20260604_131933.md
+++ /dev/null
@@ -1,60 +0,0 @@
-# Test Report — marker-api Endpoint Tests
-
-**Date:** 2026-06-04 13:19:39
-**API Base:** http://10.0.2.145:8000
-**Test files:** /home/oval/Projects/marker-api/test_files/enisa (5 file(s))
-
-## Summary
-
-| Result | Count |
-|--------|-------|
-| ✅ Passed | 5 |
-| ❌ Failed | 11 |
-| ⏭️ Skipped | 0 |
-| **Total** | **16** |
-| **Pass Rate** | **31.2%** |
-
-## Test Details
-
-| Test | Result | Time | Notes |
-|------|--------|------|-------|
-
-### Application Tests
-| app.py syntax valid | ✅ PASS | 0.003s | |
-| use_llm/llm_service params present in app.py | ✅ PASS | 0.000s | |
-| marker-convert.ps1 has all new parameters | ✅ PASS | 0.000s | |
-| README.md documents all endpoints | ✅ PASS | 0.000s | |
-| ENISA test files available | ✅ PASS | 0.017s | |
-
-### Endpoint Tests (HTTP)
-| GET /health returns 200 | ❌ FAIL | 0.003s | Cannot reach http://10.0.2.145:8000/health: [Errno 113] No route to host |
-| GET / returns docs page | ❌ FAIL | 0.001s | Cannot reach http://10.0.2.145:8000/: [Errno 113] No route to host |
-| POST /marker multipart (markdown) | ❌ FAIL | 0.000s | Cannot reach http://10.0.2.145:8000/marker: [Errno 113] No route to host |
-| POST /marker multipart (json) | ❌ FAIL | 0.000s | Cannot reach http://10.0.2.145:8000/marker: [Errno 113] No route to host |
-| POST /marker JSON base64 | ❌ FAIL | 0.000s | Cannot reach http://10.0.2.145:8000/marker: [Errno 113] No route to host |
-| POST /marker with use_llm=true | ❌ FAIL | 0.000s | Cannot reach http://10.0.2.145:8000/marker: [Errno 113] No route to host |
-| POST /marker with page_range | ❌ FAIL | 1.034s | Cannot reach http://10.0.2.145:8000/marker: [Errno 113] No route to host |
-| POST /marker missing file → 400 | ❌ FAIL | 1.025s | Cannot reach http://10.0.2.145:8000/marker: [Errno 113] No route to host |
-| POST /v1/conversions JSON | ❌ FAIL | 1.023s | Cannot reach http://10.0.2.145:8000/v1/conversions: [Errno 113] No route to host |
-| POST /v1/files/convert multipart | ❌ FAIL | 1.024s | Cannot reach http://10.0.2.145:8000/v1/files/convert: [Errno 113] No route to host |
-| POST /v1/files/convert JSON | ❌ FAIL | 1.024s | Cannot reach http://10.0.2.145:8000/v1/files/convert: [Errno 113] No route to host |
-
-## Environment
-- Python: 3.14.5
-- Platform: linux
-- marker: ❌ not installed (Pillow build failure on this platform)
-
-## Test Files
-- enisa-international-strategy-2026.pdf (39.7 KB)
-- enisa-nis360-2026.pdf (3983.3 KB)
-- enisa-stakeholder-strategy-2026-2028.pdf (35.3 KB)
-- nis-investments-2025.pdf (3118.9 KB)
-- nis2-technical-implementation-guidance.pdf (4699.7 KB)
-
-## Notes
-- HTTP endpoint tests require a running marker-api instance.
-- API-level tests were run against http://10.0.2.145:8000
-- Offline validation tests (syntax, parameter availability, docs) ran regardless.
-- The marker library could not be installed due to Pillow build failure in this sandbox.
-- For live endpoint testing, start the API with: `python app.py` (requires marker-pdf[full] + flask).
-- Failed tests may indicate missing marker library or API connectivity issues.