Spaces:
Sleeping
Sleeping
File size: 534 Bytes
56205e9 152d4a2 1cc747b 56205e9 6066e39 56205e9 152d4a2 6066e39 56205e9 152d4a2 b00c930 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
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"]} |