diff --git a/server.py b/server.py index d7aac35..6f0ed4f 100644 --- a/server.py +++ b/server.py @@ -20,7 +20,7 @@ from enum import Enum import httpx from fastapi import FastAPI, HTTPException, UploadFile, File, Form, BackgroundTasks from fastapi.middleware.cors import CORSMiddleware -from fastapi.responses import JSONResponse +from fastapi.responses import JSONResponse, HTMLResponse from pydantic import BaseModel, HttpUrl # Docling imports @@ -294,9 +294,666 @@ def extract_with_docling(file_path: Path, output_format: OutputFormat) -> tuple[ # ============== API Endpoints ============== -@app.get("/") -async def root(): - """Service info and health check""" +@app.get("/", response_class=HTMLResponse) +async def dashboard(): + """Web interface for document processing""" + html = """ + + + + + + Document Intelligence - Extract, Summarize, Index + + + +
+
+

Document Intelligence

+

Extract, summarize, and index documents into your knowledge base

+
+ +
+ +
+

📄 Input Source

+ +
+ + +
+ +
— or —
+ +
+
📁
+

Drop a file here or click to browse

+

PDF, DOCX, PPTX, XLSX, HTML, MD, TXT, EPUB, images, audio

+ +
+
+ + +
+
+ + +
+

⚙️ Processing Options

+ +
+ + +
+ +
+ + +
+ +
+ +
+ + +
+
+ + + +
+ + +
+
+

📊 Results

+
+ + + Processing... + + +
+
+ +
+
+
-
+
Pages
+
+
+
-
+
Tables
+
+
+
-
+
Figures
+
+
+
-
+
Characters
+
+
+ +
+ + + +
+ +
+
+ Processing... +
+
+
+
+ Loading content... +
+
+
+
+
+
+
+
+ +
+
+
""" + str(stats["documents_processed"]) + """
+
Documents Processed
+
+
+
""" + str(stats["pages_extracted"]) + """
+
Pages Extracted
+
+
+
""" + str(stats["audio_transcribed"]) + """
+
Audio Transcribed
+
+
+
+ + + + + """ + return HTMLResponse(content=html) + + +@app.get("/api/info") +async def api_info(): + """Service info (JSON API endpoint)""" return { "service": "Docling Service", "version": "1.0.0",