Spaces:
Runtime error
Runtime error
File size: 838 Bytes
989f4bb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
import gradio as gr
import os
import cv2
import shutil
import sys
from subprocess import call
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) |