minwoosun commited on
Commit
914e393
1 Parent(s): c776952

fix repo download separation

Browse files
Files changed (1) hide show
  1. app.py +6 -17
app.py CHANGED
@@ -74,19 +74,8 @@ def toggle_file_input(default_dataset):
74
  else:
75
  return gr.update(interactive=True) # Enable the file input if no default dataset is selected
76
 
77
- def download_files(base_path):
78
- # clone and cd into UCE repo
79
  os.system('git clone https://github.com/minwoosun/UCE.git')
80
- os.chdir(BASE_PATH)
81
-
82
- # Add the directory to the Python path
83
- sys.path.append(BASE_PATH)
84
-
85
- # Set default dataset path
86
- default_dataset_1_path = hf_hub_download(repo_id="minwoosun/uce-misc", filename="100_pbmcs_proc_subset.h5ad")
87
- default_dataset_2_path = hf_hub_download(repo_id="minwoosun/uce-misc", filename="1k_pbmcs_proc_subset.h5ad")
88
-
89
- return default_dataset_1_path, default_dataset_2_path
90
 
91
  def main(input_file_path, species, default_dataset, default_dataset_1_path, default_dataset_2_path):
92
 
@@ -99,9 +88,9 @@ def main(input_file_path, species, default_dataset, default_dataset_1_path, defa
99
  # # Add the directory to the Python path
100
  # sys.path.append(BASE_PATH)
101
 
102
- # # Set default dataset path
103
- # default_dataset_1_path = hf_hub_download(repo_id="minwoosun/uce-misc", filename="100_pbmcs_proc_subset.h5ad")
104
- # default_dataset_2_path = hf_hub_download(repo_id="minwoosun/uce-misc", filename="1k_pbmcs_proc_subset.h5ad")
105
 
106
  # If the user selects a default dataset, use that instead of the uploaded file
107
  if default_dataset == "PBMC 100 cells":
@@ -164,7 +153,7 @@ def main(input_file_path, species, default_dataset, default_dataset_1_path, defa
164
  if __name__ == "__main__":
165
 
166
  BASE_PATH = '/home/user/app/UCE/'
167
- default_dataset_1_path, default_dataset_2_path = download_files(BASE_PATH)
168
 
169
  with gr.Blocks() as demo:
170
  gr.Markdown(
@@ -232,7 +221,7 @@ if __name__ == "__main__":
232
  # Add the components and link to the function
233
  run_button.click(
234
  fn=main,
235
- inputs=[file_input, species_input, default_dataset_input, default_dataset_1_path, default_dataset_2_path],
236
  outputs=[image_output, file_output, pred_output]
237
  )
238
 
 
74
  else:
75
  return gr.update(interactive=True) # Enable the file input if no default dataset is selected
76
 
77
+ def clone_repo():
 
78
  os.system('git clone https://github.com/minwoosun/UCE.git')
 
 
 
 
 
 
 
 
 
 
79
 
80
  def main(input_file_path, species, default_dataset, default_dataset_1_path, default_dataset_2_path):
81
 
 
88
  # # Add the directory to the Python path
89
  # sys.path.append(BASE_PATH)
90
 
91
+ # Set default dataset path
92
+ default_dataset_1_path = hf_hub_download(repo_id="minwoosun/uce-misc", filename="100_pbmcs_proc_subset.h5ad")
93
+ default_dataset_2_path = hf_hub_download(repo_id="minwoosun/uce-misc", filename="1k_pbmcs_proc_subset.h5ad")
94
 
95
  # If the user selects a default dataset, use that instead of the uploaded file
96
  if default_dataset == "PBMC 100 cells":
 
153
  if __name__ == "__main__":
154
 
155
  BASE_PATH = '/home/user/app/UCE/'
156
+ clone_repo()
157
 
158
  with gr.Blocks() as demo:
159
  gr.Markdown(
 
221
  # Add the components and link to the function
222
  run_button.click(
223
  fn=main,
224
+ inputs=[file_input, species_input, default_dataset_input],
225
  outputs=[image_output, file_output, pred_output]
226
  )
227