Spaces:
Running
Running
| from fastapi import FastAPI | |
| from fastapi.responses import HTMLResponse | |
| import os | |
| app = FastAPI() | |
| async def root(): | |
| """Simple hello world endpoint""" | |
| return { | |
| "message": "Hello World from MinerU PDF Converter!", | |
| "status": "running", | |
| "environment": os.environ.get("SPACE_ID", "local") | |
| } | |
| async def health_check(): | |
| """Health check endpoint""" | |
| return {"status": "healthy", "service": "pdf2md"} | |
| async def test_page(): | |
| """Simple HTML test page""" | |
| return """ | |
| <html> | |
| <head> | |
| <title>PDF to Markdown - Test</title> | |
| <style> | |
| body { | |
| font-family: Arial, sans-serif; | |
| max-width: 800px; | |
| margin: 0 auto; | |
| padding: 20px; | |
| } | |
| .status { | |
| background: #e8f5e9; | |
| padding: 10px; | |
| border-radius: 5px; | |
| margin: 20px 0; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>PDF to Markdown Converter</h1> | |
| <div class="status"> | |
| β Service is running! | |
| </div> | |
| <p>This is a test deployment. Full functionality coming soon.</p> | |
| <p> | |
| <a href="/docs">API Documentation</a> | | |
| <a href="/health">Health Check</a> | |
| </p> | |
| </body> | |
| </html> | |
| """ | |
| async def api_info(): | |
| """API information endpoint""" | |
| return { | |
| "name": "PDF to Markdown Converter API", | |
| "version": "0.1.0", | |
| "endpoints": { | |
| "/": "Main endpoint", | |
| "/health": "Health check", | |
| "/test": "Test HTML page", | |
| "/docs": "FastAPI automatic documentation", | |
| "/api/info": "This endpoint" | |
| } | |
| } |