Download DeepFakeAI/uis/components/temp_frame.py from anonghost/copy: direct link, hf CLI and curl.
- Browser
- Download file 1.49 kB
-
https://huggingface.co/spaces/anonghost/copy/resolve/main/DeepFakeAI/uis/components/temp_frame.py
- Command line
-
hf download hf://spaces/anonghost/copy/DeepFakeAI/uis/components/temp_frame.py
-
curl -L -o temp_frame.py https://huggingface.co/spaces/anonghost/copy/resolve/main/DeepFakeAI/uis/components/temp_frame.py
1.49 kB
| from typing import Optional | |
| import gradio | |
| import DeepFakeAI.choices | |
| import DeepFakeAI.globals | |
| from DeepFakeAI import wording | |
| from DeepFakeAI.typing import TempFrameFormat | |
| from DeepFakeAI.uis.typing import Update | |
| TEMP_FRAME_FORMAT_DROPDOWN : Optional[gradio.Dropdown] = None | |
| TEMP_FRAME_QUALITY_SLIDER : Optional[gradio.Slider] = None | |
| def render() -> None: | |
| global TEMP_FRAME_FORMAT_DROPDOWN | |
| global TEMP_FRAME_QUALITY_SLIDER | |
| with gradio.Box(): | |
| TEMP_FRAME_FORMAT_DROPDOWN = gradio.Dropdown( | |
| label = wording.get('temp_frame_format_dropdown_label'), | |
| choices = DeepFakeAI.choices.temp_frame_format, | |
| value = DeepFakeAI.globals.temp_frame_format | |
| ) | |
| TEMP_FRAME_QUALITY_SLIDER = gradio.Slider( | |
| label = wording.get('temp_frame_quality_slider_label'), | |
| value = DeepFakeAI.globals.temp_frame_quality, | |
| step = 1 | |
| ) | |
| def listen() -> None: | |
| TEMP_FRAME_FORMAT_DROPDOWN.select(update_temp_frame_format, inputs = TEMP_FRAME_FORMAT_DROPDOWN, outputs = TEMP_FRAME_FORMAT_DROPDOWN) | |
| TEMP_FRAME_QUALITY_SLIDER.change(update_temp_frame_quality, inputs = TEMP_FRAME_QUALITY_SLIDER, outputs = TEMP_FRAME_QUALITY_SLIDER) | |
| def update_temp_frame_format(temp_frame_format : TempFrameFormat) -> Update: | |
| DeepFakeAI.globals.temp_frame_format = temp_frame_format | |
| return gradio.update(value = temp_frame_format) | |
| def update_temp_frame_quality(temp_frame_quality : int) -> Update: | |
| DeepFakeAI.globals.temp_frame_quality = temp_frame_quality | |
| return gradio.update(value = temp_frame_quality) | |