/
iamstacyok
/
SE_FastAPI_Example
Обзор
Документация
Войти
/
iamstacyok
/
SE_FastAPI_Example
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
1
CI/CD
Аналитика
Безопасность
feature/streamlit
main.py
25 строк
432 B
iamstacyok
refactor: replace generic text route
03 май 2026, 20:56
03 май 2026, 20:56
a90ddd4
Код
Авторство
О чём код?
from fastapi import FastAPI from pydantic import BaseModel from app.model_service import predict_sentiment class Item(BaseModel): text: str app = FastAPI(title="Sentiment Analysis API") @app.get("/") def root(): return {"message": "FastAPI service started!"} @app.get("/health") def health_check(): return {"status": "ok"} @app.post("/predict/") def predict(item: Item): return predict_sentiment(item.text)