victorisgeek commited on
Commit
a20261c
·
verified ·
1 Parent(s): d02a1ef

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -110
app.py CHANGED
@@ -223,116 +223,8 @@ def create_interface():
223
  process_video.click(fn=swap_video_fct,inputs=[source_video,video_file_path,source_face_vid,dest_face_vid, face_tolerance], outputs=output_video)
224
  preview_video.click(fn=swap_video_fct,inputs=[source_video,video_file_path,source_face_vid,dest_face_vid, face_tolerance, video_position], outputs=image_output)
225
 
226
- set_slider_range_event = set_slider_range_btn.click(
227
- video_changed,
228
- inputs=[video_input],
229
- outputs=[start_frame, end_frame, video_fps],
230
- )
231
-
232
- trim_and_reload_event = trim_and_reload_btn.click(
233
- fn=trim_and_reload,
234
- inputs=[video_input, output_directory, output_name, start_frame, end_frame],
235
- outputs=[video_input, info],
236
- )
237
-
238
- start_frame_event = start_frame.release(
239
- fn=slider_changed,
240
- inputs=[show_trim_preview_btn, video_input, start_frame],
241
- outputs=[preview_image, preview_video],
242
- show_progress=True,
243
- )
244
-
245
- end_frame_event = end_frame.release(
246
- fn=slider_changed,
247
- inputs=[show_trim_preview_btn, video_input, end_frame],
248
- outputs=[preview_image, preview_video],
249
- show_progress=True,
250
- )
251
-
252
- input_type.change(
253
- update_radio,
254
- inputs=[input_type],
255
- outputs=[input_image_group, input_video_group, input_directory_group],
256
- )
257
- swap_option.change(
258
- swap_option_changed,
259
- inputs=[swap_option],
260
- outputs=[age, specific_face, source_image_input],
261
- )
262
-
263
- apply_detection_settings.click(
264
- analyse_settings_changed,
265
- inputs=[detect_condition_dropdown, detection_size, detection_threshold],
266
- outputs=[info],
267
- )
268
-
269
- src_specific_inputs = []
270
- gen_variable_txt = ",".join(
271
- [f"src{i+1}" for i in range(NUM_OF_SRC_SPECIFIC)]
272
- + [f"trg{i+1}" for i in range(NUM_OF_SRC_SPECIFIC)]
273
- )
274
- exec(f"src_specific_inputs = ({gen_variable_txt})")
275
- swap_inputs = [
276
- input_type,
277
- image_input,
278
- video_input,
279
- direc_input,
280
- source_image_input,
281
- output_directory,
282
- output_name,
283
- keep_output_sequence,
284
- swap_option,
285
- age,
286
- distance_slider,
287
- face_enhancer_name,
288
- enable_face_parser_mask,
289
- mask_include,
290
- mask_soft_kernel,
291
- mask_soft_iterations,
292
- blur_amount,
293
- erode_amount,
294
- face_scale,
295
- enable_laplacian_blend,
296
- crop_top,
297
- crop_bott,
298
- crop_left,
299
- crop_right,
300
- *src_specific_inputs,
301
- ]
302
-
303
- swap_outputs = [
304
- info,
305
- preview_image,
306
- output_directory_button,
307
- output_video_button,
308
- preview_video,
309
- ]
310
-
311
- swap_event = swap_button.click(
312
- fn=process, inputs=swap_inputs, outputs=swap_outputs, show_progress=True
313
- )
314
-
315
- cancel_button.click(
316
- fn=stop_running,
317
- inputs=None,
318
- outputs=[info],
319
- cancels=[
320
- swap_event,
321
- trim_and_reload_event,
322
- set_slider_range_event,
323
- start_frame_event,
324
- end_frame_event,
325
- ],
326
- show_progress=True,
327
- )
328
- output_directory_button.click(
329
- lambda: open_directory(path=WORKSPACE), inputs=None, outputs=None
330
- )
331
- output_video_button.click(
332
- lambda: open_directory(path=OUTPUT_FILE), inputs=None, outputs=None
333
- )
334
-
335
-
336
 
337
 
338
 
 
223
  process_video.click(fn=swap_video_fct,inputs=[source_video,video_file_path,source_face_vid,dest_face_vid, face_tolerance], outputs=output_video)
224
  preview_video.click(fn=swap_video_fct,inputs=[source_video,video_file_path,source_face_vid,dest_face_vid, face_tolerance, video_position], outputs=image_output)
225
 
226
+ face_swap_ui.queue().launch()
227
+ #face_swap_ui.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
 
229
 
230