Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
from fastapi import FastAPI, Depends, HTTPException, Request
|
|
|
|
| 2 |
from fastapi.security import APIKeyHeader
|
| 3 |
from pydantic import BaseModel
|
| 4 |
from model import ner_pipeline
|
|
@@ -100,15 +101,15 @@ def list_users(x_api_key: str = Depends(token_header)):
|
|
| 100 |
raise HTTPException(status_code=403, detail="Admin access required")
|
| 101 |
return {"users": API_KEYS}
|
| 102 |
|
|
|
|
| 103 |
@app.get("/", include_in_schema=False)
|
| 104 |
def root():
|
| 105 |
return HTMLResponse("""
|
| 106 |
<html>
|
| 107 |
-
<head><title>
|
| 108 |
-
<body
|
| 109 |
-
<h1>✅
|
| 110 |
-
<p>
|
| 111 |
-
<p>Visit <a href="/docs">/docs</a> to explore the API interface.</p>
|
| 112 |
</body>
|
| 113 |
</html>
|
| 114 |
""")
|
|
|
|
| 1 |
from fastapi import FastAPI, Depends, HTTPException, Request
|
| 2 |
+
from fastapi.responses import HTMLResponse # ✅ Add this line
|
| 3 |
from fastapi.security import APIKeyHeader
|
| 4 |
from pydantic import BaseModel
|
| 5 |
from model import ner_pipeline
|
|
|
|
| 101 |
raise HTTPException(status_code=403, detail="Admin access required")
|
| 102 |
return {"users": API_KEYS}
|
| 103 |
|
| 104 |
+
|
| 105 |
@app.get("/", include_in_schema=False)
|
| 106 |
def root():
|
| 107 |
return HTMLResponse("""
|
| 108 |
<html>
|
| 109 |
+
<head><title>NER API</title></head>
|
| 110 |
+
<body>
|
| 111 |
+
<h1>✅ NER API is running!</h1>
|
| 112 |
+
<p>Visit <a href='/docs'>/docs</a> to try the API.</p>
|
|
|
|
| 113 |
</body>
|
| 114 |
</html>
|
| 115 |
""")
|