Spaces:
Running
Running
File size: 1,945 Bytes
2f87aed |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
from fastapi import FastAPI
from fastapi.responses import HTMLResponse
import os
app = FastAPI()
@app.get("/")
async def root():
"""Simple hello world endpoint"""
return {
"message": "Hello World from MinerU PDF Converter!",
"status": "running",
"environment": os.environ.get("SPACE_ID", "local")
}
@app.get("/health")
async def health_check():
"""Health check endpoint"""
return {"status": "healthy", "service": "pdf2md"}
@app.get("/test", response_class=HTMLResponse)
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>
"""
@app.get("/api/info")
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"
}
} |