Spaces:
Sleeping
Sleeping
| from typing import Self | |
| from pydantic import BaseModel, computed_field | |
| class GradioSettings(BaseModel): | |
| SERVER_NAME: str = "0.0.0.0" | |
| SERVER_PORT: int = 8080 | |
| ANALYTICS_ENABLED: bool = False | |
| SHARE: bool = False | |
| DEBUG: int = 0 | |
| ENABLE_MONITORING: bool = False | |
| FOOTER_LINKS: list[str] = ["gradio"] | |
| def env(self: Self) -> dict[str, str]: | |
| return { | |
| "GRADIO_SERVER_NAME": str(self.SERVER_NAME), | |
| "GRADIO_SERVER_PORT": str(self.SERVER_PORT), | |
| "GRADIO_ANALYTICS_ENABLED": str(self.ANALYTICS_ENABLED), | |
| "GRADIO_SHARE": str(self.SHARE), | |
| "GRADIO_DEBUG": str(self.DEBUG), | |
| } | |
| def config(self: Self) -> dict[str, str]: | |
| return { | |
| "server_name": self.SERVER_NAME, | |
| "server_port": self.SERVER_PORT, | |
| "debug": self.DEBUG, | |
| "enable_monitoring": self.ENABLE_MONITORING, | |
| "footer_links": self.FOOTER_LINKS, | |
| "share": self.SHARE, | |
| } | |