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