Spanicin commited on
Commit
ee40a9d
·
verified ·
1 Parent(s): f62f14f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -20,7 +20,7 @@ import moviepy.editor as mp
20
  import requests
21
  import json
22
  import pickle
23
- import re
24
  # from videoretalking import inference_function
25
  # import base64
26
  # import gfpgan_enhancer
@@ -284,10 +284,10 @@ def run_preprocessing(args):
284
 
285
  return preprocessed_data
286
 
287
- def remove_brackets(text):
288
- # Use regex to remove content in brackets at the end of the text
289
- cleaned_text = re.sub(r'\s*\[.*?\]\s*$', '', text)
290
- return cleaned_text.strip()
291
 
292
  @app.route("/run", methods=['POST'])
293
  def generate_video():
@@ -360,9 +360,8 @@ def generate_video():
360
  source_image_path = save_uploaded_file(source_image, 'source_image.png',TEMP_DIR)
361
  print(source_image_path)
362
 
363
- text_prompt_without_cititation = remove_brackets(text_prompt)
364
- print('Final output text prompt for avatar: ',text_prompt_without_cititation)
365
- driven_audio_path = generate_audio(voice_cloning, voice_gender, text_prompt_without_cititation)
366
 
367
  save_dir = tempfile.mkdtemp(dir=TEMP_DIR.name)
368
  result_folder = os.path.join(save_dir, "results")
@@ -424,6 +423,7 @@ def generate_video():
424
  "message": "Video processed and saved successfully.",
425
  "video_url": video_url,
426
  "text_prompt": text_prompt,
 
427
  "status": "success"
428
  })
429
  else:
 
20
  import requests
21
  import json
22
  import pickle
23
+ # import re
24
  # from videoretalking import inference_function
25
  # import base64
26
  # import gfpgan_enhancer
 
284
 
285
  return preprocessed_data
286
 
287
+ # def remove_brackets(text):
288
+ # # Use regex to remove content in brackets at the end of the text
289
+ # cleaned_text = re.sub(r'\s*\[.*?\]\s*$', '', text)
290
+ # return cleaned_text.strip()
291
 
292
  @app.route("/run", methods=['POST'])
293
  def generate_video():
 
360
  source_image_path = save_uploaded_file(source_image, 'source_image.png',TEMP_DIR)
361
  print(source_image_path)
362
 
363
+
364
+ driven_audio_path = generate_audio(voice_cloning, voice_gender, text_prompt)
 
365
 
366
  save_dir = tempfile.mkdtemp(dir=TEMP_DIR.name)
367
  result_folder = os.path.join(save_dir, "results")
 
423
  "message": "Video processed and saved successfully.",
424
  "video_url": video_url,
425
  "text_prompt": text_prompt,
426
+ "time_taken": time_taken,
427
  "status": "success"
428
  })
429
  else: