Spaces:
Runtime error
Runtime error
Download app.py from sadafwalliyani/TextConversionUsing: direct link, hf CLI and curl.
- Browser
- Download file 578 Bytes
-
https://huggingface.co/spaces/sadafwalliyani/TextConversionUsing/resolve/main/app.py
- Command line
-
hf download hf://spaces/sadafwalliyani/TextConversionUsing/app.py
-
curl -L -o app.py https://huggingface.co/spaces/sadafwalliyani/TextConversionUsing/resolve/main/app.py
578 Bytes
| from fastapi import FastAPI | |
| from fastapi.staticfiles import StaticFiles | |
| from fastapi.responses import FileResponse | |
| from transformers import pipeline | |
| app = FastAPI() | |
| pipe_flan = pipeline("text2text-generation", model="google/flan-t5-small") | |
| def t5(input): | |
| output = pipe_flan(input) | |
| return {"output": output[0]["generated_text"]} | |
| app.mount("/", StaticFiles(directory="static", html=True), name="static") | |
| def index() -> FileResponse: | |
| return FileResponse(path="/app/static/index.html", media_type="text/html") |