Spaces:
Sleeping
Sleeping
File size: 826 Bytes
93f4eb2 | 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 | from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from .routers import translate
app = FastAPI(
title="Google Translate API",
description="API для перевода текста через Google Translate",
version="1.0.0"
)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(translate.router)
@app.get("/")
async def root():
return {
"message": "Google Translate API",
"docs": "/docs",
"endpoints": [
"GET /api/v1/translate/?text=hello&target=ru",
"POST /api/v1/translate/",
"GET /api/v1/translate/languages"
]
}
@app.get("/health")
async def health():
return {"status": "healthy"} |