import gradio as gr import os import cv2 import shutil import sys from subprocess import call os.system("pip install dlib") os.system('bash setup.sh') def run_cmd(command): try: call(command, shell=True) except KeyboardInterrupt: print("Process interrupted") sys.exit(1) def run(image): os.makedirs("Temp") os.makedirs("Temp/input") print(type(image)) cv2.imwrite("Temp/input/input_img.png", image) command = ("python run.py --input_folder " + "Temp/input" + " --output_folder " + "Temp" + " --GPU " + "-1" + " --with_scratch") run_cmd(command) result = cv2.imread("Temp/final_output/input_img.png") shutil.rmtree("Temp") return result iface = gr.Interface(fn=run, inputs="image", outputs="image").launch(debug=True)