allekssandr commited on
Commit
b00c930
·
verified ·
1 Parent(s): 196c632

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -4,10 +4,10 @@ from transformers import pipeline
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": "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"]}