Init the project.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
from fastapi import FastAPI, HTTPException, status
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
from typing import List, Optional, Union, Dict, Any, Tuple
|
||||
from contextlib import asynccontextmanager
|
||||
import os
|
||||
|
||||
# Global model instance
|
||||
model = None
|
||||
|
||||
|
||||
app = FastAPI(
|
||||
title="GLiNER Inference Server",
|
||||
description="Named Entity Recognition, Relation Extraction, and Summarization API",
|
||||
version="1.0.0",
|
||||
)
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Health check endpoint"""
|
||||
return {"status": "healthy", "model_loaded": model is not None}
|
||||
|
||||
|
||||
@app.post("/general")
|
||||
async def general_extraction(request):
|
||||
"""Named Entity Recognition endpoint"""
|
||||
pass
|
||||
|
||||
|
||||
@app.post("/relation-extraction")
|
||||
async def relation_extraction(request):
|
||||
"""Relation Extraction endpoint"""
|
||||
pass
|
||||
|
||||
|
||||
@app.post("/summarization")
|
||||
async def summarization(request):
|
||||
"""Summarization endpoint"""
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
|
||||
port = int(os.getenv("PORT", "8000"))
|
||||
uvicorn.run(app, host="0.0.0.0", port=port)
|
||||
Reference in New Issue
Block a user