Introduce randomized action button

This commit is contained in:
henryruhs 2024-09-16 15:56:21 +02:00
parent 4ee8f9a5d4
commit a4dd8c95df
2 changed files with 26 additions and 10 deletions

View File

@ -1,24 +1,41 @@
import random
from typing import Optional
import gradio
from facefusion import metadata, wording
from facefusion import metadata
ABOUT_BUTTON : Optional[gradio.Button] = None
DONATE_BUTTON : Optional[gradio.Button] = None
METADATA_BUTTON : Optional[gradio.Button] = None
ACTION_BUTTON : Optional[gradio.Button] = None
def render() -> None:
global ABOUT_BUTTON
global DONATE_BUTTON
global METADATA_BUTTON
global ACTION_BUTTON
ABOUT_BUTTON = gradio.Button(
action = random.choice(
[
{
'wording': 'become a member',
'url': 'https://members.facefusion.io'
},
{
'wording': 'join our community',
'url': 'https://join.facefusion.io'
},
{
'wording': 'read the documentation',
'url': 'https://docs.facefusion.io'
}
])
METADATA_BUTTON = gradio.Button(
value = metadata.get('name') + ' ' + metadata.get('version'),
variant = 'primary',
link = metadata.get('url')
)
DONATE_BUTTON = gradio.Button(
value = wording.get('uis.donate_button'),
link = 'https://donate.facefusion.io',
ACTION_BUTTON = gradio.Button(
value = action.get('wording'),
link = action.get('url'),
size = 'sm'
)

View File

@ -210,7 +210,6 @@ WORDING : Dict[str, Any] =\
'benchmark_runs_checkbox_group': 'BENCHMARK RUNS',
'clear_button': 'CLEAR',
'common_options_checkbox_group': 'OPTIONS',
'donate_button': 'DONATE',
'execution_providers_checkbox_group': 'EXECUTION PROVIDERS',
'execution_queue_count_slider': 'EXECUTION QUEUE COUNT',
'execution_thread_count_slider': 'EXECUTION THREAD COUNT',