mirror of
https://github.com/facefusion/facefusion.git
synced 2026-07-30 22:07:23 +02:00
* Fix type for device id * Fix type for device id * Fix order * Remove comma * Replace Generator typing * Replace Generator typing * Conditional kill myself (#984) * Introduce conditional remove mask * fix --------- Co-authored-by: harisreedhar <h4harisreedhar.s.s@gmail.com> --------- Co-authored-by: harisreedhar <h4harisreedhar.s.s@gmail.com>
52 lines
1.0 KiB
Python
52 lines
1.0 KiB
Python
from typing import Any, Iterator, List, Optional
|
|
|
|
import gradio
|
|
|
|
from facefusion import benchmarker, state_manager, translator
|
|
|
|
BENCHMARK_BENCHMARKS_DATAFRAME : Optional[gradio.Dataframe] = None
|
|
BENCHMARK_START_BUTTON : Optional[gradio.Button] = None
|
|
|
|
|
|
def render() -> None:
|
|
global BENCHMARK_BENCHMARKS_DATAFRAME
|
|
global BENCHMARK_START_BUTTON
|
|
|
|
BENCHMARK_BENCHMARKS_DATAFRAME = gradio.Dataframe(
|
|
headers =
|
|
[
|
|
'target_path',
|
|
'cycle_count',
|
|
'average_run',
|
|
'fastest_run',
|
|
'slowest_run',
|
|
'relative_fps'
|
|
],
|
|
datatype =
|
|
[
|
|
'str',
|
|
'number',
|
|
'number',
|
|
'number',
|
|
'number',
|
|
'number'
|
|
],
|
|
show_label = False
|
|
)
|
|
BENCHMARK_START_BUTTON = gradio.Button(
|
|
value = translator.get('uis.start_button'),
|
|
variant = 'primary',
|
|
size = 'sm'
|
|
)
|
|
|
|
|
|
def listen() -> None:
|
|
BENCHMARK_START_BUTTON.click(start, outputs = BENCHMARK_BENCHMARKS_DATAFRAME)
|
|
|
|
|
|
def start() -> Iterator[List[Any]]:
|
|
state_manager.sync_state()
|
|
|
|
for benchmark in benchmarker.run():
|
|
yield [ list(benchmark_set.values()) for benchmark_set in benchmark ]
|