Kek-bot / app.py
allekssandr's picture
Update app.py
152d4a2 verified
raw
history blame
534 Bytes
from fastapi import FastAPI
from llama_cpp import Llama
app = FastAPI()
# Загрузка модели Hugging Face
llm = Llama.from_pretrained(
repo_id="bartowski/Phi-3.5-mini-instruct-GGUF",
filename="Phi-3.5-mini-instruct-IQ2_M.gguf",
)
@app.post("/predict")
async def predict(text: str):
# Генерация ответа с помощью модели
response = llm.create_chat_completion(
messages = [
{
"role": "user",
"content": text
}
]
)
return {"response": result[0]["generated_text"]}