You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.0 KiB
46 lines
1.0 KiB
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)
|