File size: 1,410 Bytes
2faefa9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from typing import Optional
import gradio

import DeepFakeAI.globals
from DeepFakeAI import wording
from DeepFakeAI.uis.typing import Update

KEEP_FPS_CHECKBOX : Optional[gradio.Checkbox] = None
KEEP_TEMP_CHECKBOX : Optional[gradio.Checkbox] = None
SKIP_AUDIO_CHECKBOX : Optional[gradio.Checkbox] = None


def render() -> None:
	global KEEP_FPS_CHECKBOX
	global KEEP_TEMP_CHECKBOX
	global SKIP_AUDIO_CHECKBOX

	with gradio.Box():
		KEEP_FPS_CHECKBOX = gradio.Checkbox(
			label = wording.get('keep_fps_checkbox_label'),
			value = DeepFakeAI.globals.keep_fps
		)
		KEEP_TEMP_CHECKBOX = gradio.Checkbox(
			label = wording.get('keep_temp_checkbox_label'),
			value = DeepFakeAI.globals.keep_temp
		)
		SKIP_AUDIO_CHECKBOX = gradio.Checkbox(
			label = wording.get('skip_audio_checkbox_label'),
			value = DeepFakeAI.globals.skip_audio
		)


def listen() -> None:
	KEEP_FPS_CHECKBOX.change(lambda value: update_checkbox('keep_fps', value), inputs = KEEP_FPS_CHECKBOX, outputs = KEEP_FPS_CHECKBOX)
	KEEP_TEMP_CHECKBOX.change(lambda value: update_checkbox('keep_temp', value), inputs = KEEP_TEMP_CHECKBOX, outputs = KEEP_TEMP_CHECKBOX)
	SKIP_AUDIO_CHECKBOX.change(lambda value: update_checkbox('skip_audio', value), inputs = SKIP_AUDIO_CHECKBOX, outputs = SKIP_AUDIO_CHECKBOX)


def update_checkbox(name : str, value: bool) -> Update:
	setattr(DeepFakeAI.globals, name, value)
	return gradio.update(value = value)