manhkhanhUIT commited on
Commit
08ad16b
1 Parent(s): 9f1e078

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -15
app.py CHANGED
@@ -4,6 +4,7 @@ import cv2
4
  import shutil
5
  import sys
6
  from subprocess import call
 
7
 
8
  os.system("pip install dlib")
9
  os.system('bash setup.sh')
@@ -16,23 +17,25 @@ def run_cmd(command):
16
  sys.exit(1)
17
 
18
  def run(image):
19
- os.makedirs("Temp")
20
- os.makedirs("Temp/input")
21
- print(type(image))
22
- cv2.imwrite("Temp/input/input_img.png", image)
23
 
24
- command = ("python run.py --input_folder "
25
- + "Temp/input"
26
- + " --output_folder "
27
- + "Temp"
28
- + " --GPU "
29
- + "-1"
30
- + " --with_scratch")
31
- run_cmd(command)
32
 
33
- result = cv2.imread("Temp/final_output/input_img.png")
34
- shutil.rmtree("Temp")
 
 
35
 
36
  return result
37
 
38
- iface = gr.Interface(fn=run, inputs="image", outputs="image").launch(debug=True)
 
4
  import shutil
5
  import sys
6
  from subprocess import call
7
+ from utils import Restoration
8
 
9
  os.system("pip install dlib")
10
  os.system('bash setup.sh')
 
17
  sys.exit(1)
18
 
19
  def run(image):
20
+ # os.makedirs("Temp")
21
+ # os.makedirs("Temp/input")
22
+ # print(type(image))
23
+ # cv2.imwrite("Temp/input/input_img.png", image)
24
 
25
+ # command = ("python run.py --input_folder "
26
+ # + "Temp/input"
27
+ # + " --output_folder "
28
+ # + "Temp"
29
+ # + " --GPU "
30
+ # + "-1"
31
+ # + " --with_scratch")
32
+ # run_cmd(command)
33
 
34
+ # result = cv2.imread("Temp/final_output/input_img.png")
35
+ # shutil.rmtree("Temp")
36
+
37
+ result = Restoration(image)
38
 
39
  return result
40
 
41
+ iface = gr.Interface(fn=run, inputs="image", outputs="image").launch(debug=True, share=True)