NightRaven109 commited on
Commit
26122c2
·
verified ·
1 Parent(s): f9f0747

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -11,14 +11,23 @@ os.system(
11
  @spaces.GPU
12
  def inference(img):
13
  os.makedirs("./test", exist_ok=True)
 
14
  basewidth = 512
15
  wpercent = (basewidth / float(img.size[0]))
16
  hsize = int((float(img.size[1]) * float(wpercent)))
17
  img = img.resize((basewidth, hsize), Image.BILINEAR)
18
  img.save("test/1.png", "PNG")
19
- os.system(
 
20
  'python main_test_CMFNet.py --input_dir test --weights experiments/pretrained_models/deblur_GoPro_CMFNet.pth')
21
- return 'results/1.png'
 
 
 
 
 
 
 
22
 
23
 
24
  title = "Compound Multi-branch Feature Fusion for Image Restoration (Deblur)"
 
11
  @spaces.GPU
12
  def inference(img):
13
  os.makedirs("./test", exist_ok=True)
14
+ os.makedirs("./results", exist_ok=True)
15
  basewidth = 512
16
  wpercent = (basewidth / float(img.size[0]))
17
  hsize = int((float(img.size[1]) * float(wpercent)))
18
  img = img.resize((basewidth, hsize), Image.BILINEAR)
19
  img.save("test/1.png", "PNG")
20
+
21
+ result = os.system(
22
  'python main_test_CMFNet.py --input_dir test --weights experiments/pretrained_models/deblur_GoPro_CMFNet.pth')
23
+
24
+ output_path = 'results/1.png'
25
+ if os.path.exists(output_path):
26
+ return output_path
27
+ else:
28
+ print(f"Error: Output file not found at {output_path}")
29
+ print(f"Command exit code: {result}")
30
+ return None
31
 
32
 
33
  title = "Compound Multi-branch Feature Fusion for Image Restoration (Deblur)"