Kek-bot / app.py
allekssandr's picture
Update app.py
56205e9 verified
raw
history blame
445 Bytes
from fastapi import FastAPI
from transformers import pipeline
app = FastAPI()
# Загрузка модели Hugging Face
model = pipeline("text-generation", model="bartowski/Phi-3.5-mini-instruct-GGUF")
@app.post("/predict")
async def predict(text: str):
# Генерация ответа с помощью модели
result = model(text, max_length=50, num_return_sequences=1)
return {"response": result[0]["generated_text"]}