Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from fastapi import FastAPI
|
2 |
from transformers import pipeline
|
3 |
|
4 |
|
@@ -7,7 +7,7 @@ from transformers import pipeline
|
|
7 |
app = FastAPI(docs_url="/")
|
8 |
|
9 |
pipe = pipeline("text2text-generation", model="google/flan-t5-small")
|
10 |
-
|
11 |
|
12 |
@app.get("/generate")
|
13 |
def generate(text: str):
|
@@ -17,4 +17,10 @@ def generate(text: str):
|
|
17 |
can be found [here](https://huggingface.co/google/flan-t5-small).
|
18 |
"""
|
19 |
output = pipe(text)
|
20 |
-
return {"output": output[0]["generated_text"]}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI, UploadFile
|
2 |
from transformers import pipeline
|
3 |
|
4 |
|
|
|
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):
|
|
|
17 |
can be found [here](https://huggingface.co/google/flan-t5-small).
|
18 |
"""
|
19 |
output = pipe(text)
|
20 |
+
return {"output": output[0]["generated_text"]}
|
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)))
|