mineru2 / app.py
marcosremar2's picture
Add Hello World API test
2f87aed
raw
history blame
1.95 kB
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"
}
}