Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,10 +4,10 @@ from transformers import pipeline
|
|
4 |
app = FastAPI()
|
5 |
|
6 |
# Загрузка модели Hugging Face
|
7 |
-
|
8 |
|
9 |
@app.post("/predict")
|
10 |
async def predict(text: str):
|
11 |
# Генерация ответа с помощью модели
|
12 |
-
|
13 |
-
return {"response": "generated_text"}
|
|
|
4 |
app = FastAPI()
|
5 |
|
6 |
# Загрузка модели Hugging Face
|
7 |
+
model = pipeline("text-generation", model="bartowski/Phi-3.5-mini-instruct-GGUF")
|
8 |
|
9 |
@app.post("/predict")
|
10 |
async def predict(text: str):
|
11 |
# Генерация ответа с помощью модели
|
12 |
+
result = model(text, max_length=50, num_return_sequences=1)
|
13 |
+
return {"response": result[0]["generated_text"]}
|