Spaces:
Running
Running
Download app.py from jonathanjordan21/Test-ticketing: direct link, hf CLI and curl.
- Browser
- Download file 575 Bytes
-
https://huggingface.co/spaces/jonathanjordan21/Test-ticketing/resolve/main/app.py
- Command line
-
hf download hf://spaces/jonathanjordan21/Test-ticketing/app.py
-
curl -L -o app.py https://huggingface.co/spaces/jonathanjordan21/Test-ticketing/resolve/main/app.py
575 Bytes
| from fastapi import FastAPI | |
| from pydantic import BaseModel | |
| from typing import Optional | |
| from transformers import pipeline | |
| app = FastAPI() | |
| summarizer = pipeline( | |
| "summarization", | |
| # model="Falconsai/text_summarization" | |
| model="pszemraj/long-t5-tglobal-base-16384-book-summary" | |
| ) | |
| class InputText(BaseModel): | |
| text: str | |
| app = FastAPI() | |
| def greet_json(): | |
| return {"Hello": "World!"} | |
| def summary(inp: InputText): | |
| print(inp.text) | |
| return summarizer(inp.text[:3600], max_length=2048, min_length=30, do_sample=False) |