Spaces:
Runtime error
Runtime error
Update app.py
Browse files12342 unmodified lines789101112133 unmodified lines17181920from fastapi import FastAPIfrom transformers import pipeline2 unmodified linesapp = FastAPI(docs_url="/")pipe = pipeline("text2text-generation", model="google/flan-t5-small")@app.get("/generate")def generate(text: str):3 unmodified linescan be found [here](https://huggingface.co/google/flan-t5-small)."""output = pipe(text)return {"output": output[0]["generated_text"]}12342 unmodified lines789101112133 unmodified lines17181920212223242526from fastapi import FastAPI, UploadFilefrom transformers import pipeline2 unmodified linesapp = FastAPI(docs_url="/")pipe = pipeline("text2text-generation", model="google/flan-t5-small")categories = ('Heart', 'Oblong', 'Oval', 'Round', 'Square')@app.get("/generate")def generate(text: str):3 unmodified linescan be found [here](https://huggingface.co/google/flan-t5-small)."""output = pipe(text)return {"output": output[0]["generated_text"]}@app.post("/uploadfile/")async def create_upload_file(file: UploadFile):return {"test":"test123"}# pred, idx, probs = learn.predict(img)# return dict(zip(categories, map(float, probs)))
app.py+9-3