eprakash commited on
Commit
4269813
1 Parent(s): b6b19ff

Update ct_seg_gradio.py

Browse files
Files changed (1) hide show
  1. ct_seg_gradio.py +11 -0
ct_seg_gradio.py CHANGED
@@ -4,8 +4,11 @@ import time
4
  import os
5
  from glob import glob
6
  from PIL import Image
 
7
  #import torchvision.transforms as transforms
8
 
 
 
9
  num_rank = 200
10
  image_prefix = "ct_synthetic_60_large/"
11
  mask_prefix = "ct/orig_masks/"
@@ -59,6 +62,10 @@ def find_completed_idxs(save_path=save_path):
59
  return file_list, incorrect_files
60
 
61
  def load_next(rank, img_1, mask_1, img_2, mask_2, img_3, mask_3, img_4, mask_4, example, ids=image_ids, image_prefix=image_prefix, save_path=save_path):
 
 
 
 
62
  file_list, incorrect_files = find_completed_idxs()
63
  print(str(file_list) + " " + str(incorrect_files))
64
  if (int(example) not in file_list or int(example) in incorrect_files):
@@ -66,6 +73,10 @@ def load_next(rank, img_1, mask_1, img_2, mask_2, img_3, mask_3, img_4, mask_4,
66
  r_fp = open(save_path + "/" + str(int(example)) +".txt", "w")
67
  r_fp.write(r + "\n")
68
  r_fp.close()
 
 
 
 
69
  file_list, incorrect_files = find_completed_idxs()
70
  if (len(incorrect_files) != 0):
71
  example = incorrect_files[-1]
 
4
  import os
5
  from glob import glob
6
  from PIL import Image
7
+ from huggingface_hub import HfApi
8
  #import torchvision.transforms as transforms
9
 
10
+ api = HfApi()
11
+
12
  num_rank = 200
13
  image_prefix = "ct_synthetic_60_large/"
14
  mask_prefix = "ct/orig_masks/"
 
62
  return file_list, incorrect_files
63
 
64
  def load_next(rank, img_1, mask_1, img_2, mask_2, img_3, mask_3, img_4, mask_4, example, ids=image_ids, image_prefix=image_prefix, save_path=save_path):
65
+ api.upload_folder(
66
+ folder_path="/home/user/app/ct_seg_ranks",
67
+ repo_id="eprakash/gradio",
68
+ repo_type="space",)
69
  file_list, incorrect_files = find_completed_idxs()
70
  print(str(file_list) + " " + str(incorrect_files))
71
  if (int(example) not in file_list or int(example) in incorrect_files):
 
73
  r_fp = open(save_path + "/" + str(int(example)) +".txt", "w")
74
  r_fp.write(r + "\n")
75
  r_fp.close()
76
+ api.upload_folder(
77
+ folder_path="/home/user/app/ct_seg_ranks",
78
+ repo_id="eprakash/gradio",
79
+ repo_type="space",)
80
  file_list, incorrect_files = find_completed_idxs()
81
  if (len(incorrect_files) != 0):
82
  example = incorrect_files[-1]