Download app/models/models.py from saskarkhadka/summarization-backend: direct link, hf CLI and curl.
- Browser
- Download file 705 Bytes
-
https://huggingface.co/spaces/saskarkhadka/summarization-backend/resolve/main/app/models/models.py
- Command line
-
hf download hf://spaces/saskarkhadka/summarization-backend/app/models/models.py
-
curl -L -o models.py https://huggingface.co/spaces/saskarkhadka/summarization-backend/resolve/main/app/models/models.py
705 Bytes
| from pydantic import BaseModel, Field | |
| from enum import Enum | |
| class SummarizationModel(str, Enum): | |
| transformer = "transformer" | |
| mbart = 'mbart' | |
| mt5 = 'mt5' | |
| bloomz = 'bloomz' | |
| mt0 = 'mt0' | |
| gpt2_nepali = 'gpt2_nepali' | |
| gpt2_nepali_instruct = 'gpt2_nepali_instruct' | |
| nepbart = "nepbart" | |
| class SummarizationRequest(BaseModel): | |
| text: str | |
| model: SummarizationModel = Field(default=SummarizationModel.mbart) | |
| num_beams: int = Field(default=3, ge=1, le=7) | |
| temperature: float = Field(default=1.0, ge=0, le=1) | |
| top_k: int = Field(default=50, ge=1, le=100) | |
| class InferenceResult(BaseModel): | |
| prediction: str | |
| class SummarizationResponse(InferenceResult): | |
| pass |