face_swap_api / facefusion /app_context.py
navonapp's picture
Upload 168 files
c1e7277 verified
raw
history blame contribute delete
351 Bytes
import os
import sys
from facefusion.typing import AppContext
def detect_app_context() -> AppContext:
frame = sys._getframe(1)
while frame:
if os.path.join('facefusion', 'jobs') in frame.f_code.co_filename:
return 'cli'
if os.path.join('facefusion', 'uis') in frame.f_code.co_filename:
return 'ui'
frame = frame.f_back
return 'cli'