Spaces:
Runtime error
Runtime error
Download utils/ui_settings.py from titanhacker/med-bot: direct link, hf CLI and curl.
- Browser
- Download file 975 Bytes
-
https://huggingface.co/spaces/titanhacker/med-bot/resolve/main/utils/ui_settings.py
- Command line
-
hf download hf://spaces/titanhacker/med-bot/utils/ui_settings.py
-
curl -L -o ui_settings.py https://huggingface.co/spaces/titanhacker/med-bot/resolve/main/utils/ui_settings.py
975 Bytes
| import gradio as gr | |
| class UISettings: | |
| """ | |
| Utility class for managing UI settings. | |
| This class provides static methods for toggling UI components, such as a sidebar. | |
| """ | |
| def toggle_sidebar(state): | |
| """ | |
| Toggle the visibility state of a UI component. | |
| Parameters: | |
| state: The current state of the UI component. | |
| Returns: | |
| Tuple: A tuple containing the updated UI component state and the new state. | |
| """ | |
| state = not state | |
| return gr.update(visible=state), state | |
| def feedback(data: gr.LikeData): | |
| """ | |
| Process user feedback on the generated response. | |
| Parameters: | |
| data (gr.LikeData): Gradio LikeData object containing user feedback. | |
| """ | |
| if data.liked: | |
| print("You upvoted this response: " + data.value) | |
| else: | |
| print("You downvoted this response: " + data.value) | |