mr2along commited on
Commit
ffe405b
·
verified ·
1 Parent(s): 54fd6b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -127,7 +127,7 @@ def swap_faces(target_files, male_file, female_file, enhancer_name="NONE"):
127
  # Save the output image to a temporary file
128
  with tempfile.NamedTemporaryFile(suffix=ext, delete=False) as temp_file:
129
  output_path = temp_file.name
130
- #cv2.imwrite(output_path, out_frame[:, :, ::-1]) # Convert BGR to RGB before saving
131
  output_files.append(output_path)
132
 
133
  print(f"✔ Hoàn tất tất cả trong {time.time() - start_time:.2f}s")
@@ -142,7 +142,7 @@ with gr.Blocks() as demo:
142
  target_input = gr.Files(label="Files đích (ảnh)", file_types=[".jpg", ".png"])
143
  male_input = gr.File(label="File nguồn Nam (ảnh)", file_types=[".jpg", ".png"])
144
  female_input = gr.File(label="File nguồn Nữ (ảnh)", file_types=[".jpg", ".png"])
145
- enhancer = gr.Dropdown(ENHANCER_CHOICES, label="Face Enhancer", value="NONE")
146
  run_btn = gr.Button("✨ Swap")
147
 
148
  with gr.Column():
 
127
  # Save the output image to a temporary file
128
  with tempfile.NamedTemporaryFile(suffix=ext, delete=False) as temp_file:
129
  output_path = temp_file.name
130
+ cv2.imwrite(output_path, out_frame) # Convert BGR to RGB before saving
131
  output_files.append(output_path)
132
 
133
  print(f"✔ Hoàn tất tất cả trong {time.time() - start_time:.2f}s")
 
142
  target_input = gr.Files(label="Files đích (ảnh)", file_types=[".jpg", ".png"])
143
  male_input = gr.File(label="File nguồn Nam (ảnh)", file_types=[".jpg", ".png"])
144
  female_input = gr.File(label="File nguồn Nữ (ảnh)", file_types=[".jpg", ".png"])
145
+ enhancer = gr.Dropdown(ENHANCER_CHOICES, label="Face Enhancer", value="REAL-ESRGAN 2x")
146
  run_btn = gr.Button("✨ Swap")
147
 
148
  with gr.Column():