ClaireOzzz commited on
Commit
3da6cfd
1 Parent(s): 62c2b0b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -12,6 +12,8 @@ import os
12
  import spaces
13
  import random
14
  import torch
 
 
15
 
16
  from transformers import GLPNFeatureExtractor, GLPNForDepthEstimation
17
  from transformers import AutoFeatureExtractor, AutoModelForDepthEstimation
@@ -51,6 +53,8 @@ if os.path.exists(counter_file_path):
51
  else:
52
  counter = 0
53
 
 
 
54
 
55
  def check_use_custom_or_no(value):
56
  if value is True:
@@ -236,6 +240,19 @@ def infer(use_custom_model, model_name, weight_name, custom_lora_weight, image_i
236
  images[0].save(f"viteGradio/images/result{counter}.png")
237
  print("HELP")
238
  predict(images[0], counter)
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  counter+=1
240
  with open(counter_file_path, "w") as file:
241
  file.write(str(counter))
 
12
  import spaces
13
  import random
14
  import torch
15
+ import json
16
+
17
 
18
  from transformers import GLPNFeatureExtractor, GLPNForDepthEstimation
19
  from transformers import AutoFeatureExtractor, AutoModelForDepthEstimation
 
53
  else:
54
  counter = 0
55
 
56
+ generated_files = []
57
+
58
 
59
  def check_use_custom_or_no(value):
60
  if value is True:
 
240
  images[0].save(f"viteGradio/images/result{counter}.png")
241
  print("HELP")
242
  predict(images[0], counter)
243
+
244
+ with open('viteGradio/images/names.json', 'r') as f:
245
+ filenames = json.load(f)
246
+
247
+ result_filename = f"result{counter}.png"
248
+ depth_filename = f"depth{counter}.png"
249
+
250
+ filenames.append(result_filename)
251
+ filenames.append(depth_filename)
252
+
253
+ with open('viteGradio/images/names.json', 'w') as f:
254
+ json.dump(filenames, f)
255
+
256
  counter+=1
257
  with open(counter_file_path, "w") as file:
258
  file.write(str(counter))