Stefano5699 commited on
Commit
7983ea4
·
verified ·
1 Parent(s): 32a5890

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -8,6 +8,7 @@ app = FastAPI(docs_url="/")
8
 
9
  pipe = pipeline("text2text-generation", model="google/flan-t5-small")
10
  categories = ('Heart', 'Oblong', 'Oval', 'Round', 'Square')
 
11
 
12
  @app.get("/generate")
13
  def generate(text: str):
@@ -21,6 +22,7 @@ def generate(text: str):
21
 
22
  @app.post("/uploadfile/")
23
  async def create_upload_file(file: UploadFile):
24
- return {"test":"test123"}
 
25
  # pred, idx, probs = learn.predict(img)
26
  # return dict(zip(categories, map(float, probs)))
 
8
 
9
  pipe = pipeline("text2text-generation", model="google/flan-t5-small")
10
  categories = ('Heart', 'Oblong', 'Oval', 'Round', 'Square')
11
+ learn = load_learner('model.pkl')
12
 
13
  @app.get("/generate")
14
  def generate(text: str):
 
22
 
23
  @app.post("/uploadfile/")
24
  async def create_upload_file(file: UploadFile):
25
+ pred, idx, probs = learn.predict(img)
26
+ return dict(zip(categories, map(float, probs)))
27
  # pred, idx, probs = learn.predict(img)
28
  # return dict(zip(categories, map(float, probs)))