Update app.py
Browse files10 unmodified lines11121314151617181911 unmodified lines31323334353637383940414221 unmodified lines6465666768697071727374757677787910 unmodified lines)from roop.processors.frame.core import get_frame_processors_modulesfrom roop.utilities import normalize_output_pathfrom PIL import Imagedef swap_face(source_file, target_file, do_face_enhancer):source_path = "input.jpg"target_path = "target.jpg"11 unmodified linesroop.globals.output_path = normalize_output_path(roop.globals.source_path, roop.globals.target_path, output_path)if do_face_enhancer:roop.globals.frame_processors = ["face_swapper", "face_enhancer"]else:roop.globals.frame_processors = ["face_swapper"]roop.globals.headless = Trueroop.globals.keep_fps = Trueroop.globals.keep_audio = True21 unmodified linesstart()return output_pathapp = gr.Interface(fn=swap_face,inputs=[gr.Image(),gr.Image(),gr.Checkbox(label="Enable Face Enhancer", default=False, key="do_face_enhancer", info="Toggle face enhancer on/off")],outputs="image")app.launch()10 unmodified lines11121314151617181920212211 unmodified lines3435363738394041424321 unmodified lines656667686970717210 unmodified lines)from roop.processors.frame.core import get_frame_processors_modulesfrom roop.utilities import normalize_output_pathimport osfrom PIL import Imagedef swap_face(source_file, target_file,doFaceEnhancer):source_path = "input.jpg"target_path = "target.jpg"11 unmodified linesroop.globals.output_path = normalize_output_path(roop.globals.source_path, roop.globals.target_path, output_path)if doFaceEnhancer :roop.globals.frame_processors = ["face_swapper","face_enhancer"]else:roop.globals.frame_processors = ["face_swapper"]roop.globals.headless = Trueroop.globals.keep_fps = Trueroop.globals.keep_audio = True21 unmodified linesstart()return output_pathapp = gr.Interface(fn=swap_face, inputs=[gr.Image(), gr.Image(),gr.Checkbox(label="face_enhancer?", info="do face enhancer?")], outputs="image")app.launch()
app.py+9-16