allekssandr commited on
Commit
56205e9
·
verified ·
1 Parent(s): 7ba7f33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -13
app.py CHANGED
@@ -1,16 +1,13 @@
1
- from llama_cpp import Llama
 
2
 
3
- llm = Llama.from_pretrained(
4
- repo_id="microsoft/Phi-3-mini-4k-instruct-gguf",
5
- filename="Phi-3-mini-4k-instruct-fp16.gguf",
6
- )
7
 
8
- output = llm(
9
- "Once upon a time,",
10
- max_tokens=512,
11
- echo=True
12
- )
13
- print(output)
14
 
15
- if __name__ == '__app__':
16
- app()
 
 
 
 
1
+ from fastapi import FastAPI
2
+ from transformers import pipeline
3
 
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"]}