Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
|
|
|
| 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)))
|