File size: 1,490 Bytes
747a865
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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)