Download app.py from Credbox/Rephrase: direct link, hf CLI and curl.
- Browser
- Download file 577 Bytes
-
https://huggingface.co/spaces/Credbox/Rephrase/resolve/main/app.py
- Command line
-
hf download hf://spaces/Credbox/Rephrase/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Credbox/Rephrase/resolve/main/app.py
577 Bytes
| from fastapi import FastAPI | |
| from pydantic import BaseModel | |
| from fastapi.responses import JSONResponse | |
| from Paraphrase import paraphrase_paragraph | |
| app = FastAPI() | |
| class Sentence(BaseModel): | |
| sentence: str | |
| def index(): | |
| return "OK" | |
| def rephrase(sentence: Sentence): | |
| try: | |
| rephrase_text = paraphrase_paragraph(sentence.sentence) | |
| return JSONResponse(status_code=200, content={"rephrased_sentence": rephrase_text}) | |
| except Exception as e: | |
| return JSONResponse(status_code=422,content="Unable to rephrase") |