File size: 445 Bytes
56205e9
 
1cc747b
56205e9
6066e39
56205e9
 
6066e39
56205e9
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
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"]}