Files
facefusion/facefusion/content_store.py
T
Henry Ruhs 1362afa8b7 content store (#1225)
* introduce content store for content analyser

* introduce content store for content analyser part2

* guard content store as well

* minor changes

* minor changes

* minor changes
2026-08-27 11:23:18 +02:00

33 lines
595 B
Python

from facefusion.types import ContentSet
CONTENT_STORE : ContentSet =\
{
'hit': 0,
'total': 0
}
def tick(step : int = 30) -> bool:
CONTENT_STORE['total'] += 1
return CONTENT_STORE.get('total') % step == 0
def get_hit() -> int:
return CONTENT_STORE.get('hit')
def set_hit() -> None:
CONTENT_STORE['hit'] += 1
def calculate_rate(step : int = 30) -> float:
if CONTENT_STORE.get('hit') and CONTENT_STORE.get('total'):
return CONTENT_STORE.get('hit') / CONTENT_STORE.get('total') * step * 100
return 0.0
def clear() -> None:
CONTENT_STORE['hit'] = 0
CONTENT_STORE['total'] = 0