huzey commited on
Commit
d245991
1 Parent(s): edc0dc6

optimize run

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -148,6 +148,10 @@ def quick_run(*args, **kwargs):
148
  def long_run(*args, **kwargs):
149
  return ncut_run(*args, **kwargs)
150
 
 
 
 
 
151
  @spaces.GPU(duration=120)
152
  def super_duper_long_run(*args, **kwargs):
153
  return ncut_run(*args, **kwargs)
@@ -193,11 +197,14 @@ def run_fn(
193
  if num_images > 20:
194
  return long_run(images, **kwargs)
195
  if embedding_method == "UMAP":
 
 
196
  return long_run(images, **kwargs)
197
- if perplexity >= 250:
198
- return long_run(images, **kwargs)
199
- if num_sample_tsne >= 500:
200
- return long_run(images, **kwargs)
 
201
  return quick_run(images, **kwargs)
202
 
203
  with gr.Blocks() as demo:
@@ -233,7 +240,7 @@ with gr.Blocks() as demo:
233
  min_dist_slider = gr.Slider(0.1, 1, step=0.1, label="min_dist (UMAP)", value=0.1, elem_id="min_dist")
234
 
235
  # logging text box
236
- logging_text = gr.Textbox("logging output", label="Logging", elem_id="logging", type="text", placeholder="Logging information", default="")
237
 
238
  def load_default_images():
239
  return default_images, default_outputs, []
 
148
  def long_run(*args, **kwargs):
149
  return ncut_run(*args, **kwargs)
150
 
151
+ @spaces.GPU(duration=60)
152
+ def longer_run(*args, **kwargs):
153
+ return ncut_run(*args, **kwargs)
154
+
155
  @spaces.GPU(duration=120)
156
  def super_duper_long_run(*args, **kwargs):
157
  return ncut_run(*args, **kwargs)
 
197
  if num_images > 20:
198
  return long_run(images, **kwargs)
199
  if embedding_method == "UMAP":
200
+ if perplexity >= 250 or num_sample_tsne >= 500:
201
+ return longer_run(images, **kwargs)
202
  return long_run(images, **kwargs)
203
+ if embedding_method == "t-SNE":
204
+ if perplexity >= 250 or num_sample_tsne >= 500:
205
+ return long_run(images, **kwargs)
206
+ return quick_run(images, **kwargs)
207
+
208
  return quick_run(images, **kwargs)
209
 
210
  with gr.Blocks() as demo:
 
240
  min_dist_slider = gr.Slider(0.1, 1, step=0.1, label="min_dist (UMAP)", value=0.1, elem_id="min_dist")
241
 
242
  # logging text box
243
+ logging_text = gr.Textbox("Logging information", label="Logging", elem_id="logging", type="text", placeholder="Logging information")
244
 
245
  def load_default_images():
246
  return default_images, default_outputs, []