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"]}