huzey commited on
Commit
f4346e9
1 Parent(s): d90b17f

update msg

Browse files
Files changed (2) hide show
  1. app.py +10 -2
  2. app_text.py +23 -10
app.py CHANGED
@@ -2447,7 +2447,7 @@ with demo:
2447
  inspect_logging_text = gr.Textbox("Logging information", lines=3, label="Logging", elem_id="inspect_logging", type="text", placeholder="Logging information", autofocus=False, autoscroll=False)
2448
  # output_slot_radio = gr.Radio([1, 2, 3], label="Output Row", value=1, elem_id="output_slot", show_label=True)
2449
 
2450
- delete_all_output_button = gr.Button("❌ Delete All", elem_id="delete_all_output", variant='secondary')
2451
 
2452
  image_select.visible = False
2453
  tsne_select.visible = True
@@ -2606,7 +2606,7 @@ with demo:
2606
  break
2607
  if not found_flag:
2608
  i_slot = 0
2609
- gr.Warning("Output slots are full, Overwriting the first row. Please use '❌ Delete All' to clear all outputs.")
2610
  output_row_occupy[i_slot] = True
2611
  # tree_label = f"spectral-tSNE tree [row#{max_rows-output_slot}] k={granularity} idx={closest_idx} n={len(connected_idxs)}"
2612
  tree_label = f"spectral-tSNE tree [row#{current_output_row+1}]"
@@ -4450,3 +4450,11 @@ demo.launch(share=True)
4450
  # %%
4451
 
4452
  # %%
 
 
 
 
 
 
 
 
 
2447
  inspect_logging_text = gr.Textbox("Logging information", lines=3, label="Logging", elem_id="inspect_logging", type="text", placeholder="Logging information", autofocus=False, autoscroll=False)
2448
  # output_slot_radio = gr.Radio([1, 2, 3], label="Output Row", value=1, elem_id="output_slot", show_label=True)
2449
 
2450
+ delete_all_output_button = gr.Button("❌ Delete All Output", elem_id="delete_all_output", variant='secondary')
2451
 
2452
  image_select.visible = False
2453
  tsne_select.visible = True
 
2606
  break
2607
  if not found_flag:
2608
  i_slot = 0
2609
+ gr.Warning("Output slots are full, Overwriting the first row. Please use '❌ Delete All Output' to clear all outputs.")
2610
  output_row_occupy[i_slot] = True
2611
  # tree_label = f"spectral-tSNE tree [row#{max_rows-output_slot}] k={granularity} idx={closest_idx} n={len(connected_idxs)}"
2612
  tree_label = f"spectral-tSNE tree [row#{current_output_row+1}]"
 
4450
  # %%
4451
 
4452
  # %%
4453
+
4454
+ # %%
4455
+
4456
+ # %%
4457
+
4458
+ # %%
4459
+
4460
+ # %%
app_text.py CHANGED
@@ -246,17 +246,30 @@ def real_run(model_name, text, layer, node_type, num_eig, affinity_focal_gamma,
246
  affinity_focal_gamma, num_sample_ncut, knn_ncut, embedding_method,
247
  num_sample_tsne, knn_tsne, perplexity, n_neighbors, min_dist, sampling_method)
248
 
 
 
 
 
 
 
 
 
 
 
 
 
249
  lines = \
250
- """1. The majestic giraffe, with its towering height and distinctive long neck, roams the savannas of Africa. These gentle giants use their elongated tongues to pluck leaves from the tallest trees, making them well-adapted to their environment. Their unique coat patterns, much like human fingerprints, are unique to each individual.
251
- 2. Penguins, the tuxedoed birds of the Antarctic, are expert swimmers and divers. These flightless seabirds rely on their dense, waterproof feathers and streamlined bodies to propel through icy waters in search of fish, krill, and other marine life. Their huddled colonies and amusing waddles make them a favorite among wildlife enthusiasts.
252
- 3. The mighty African elephant, the largest land mammal, is revered for its intelligence and strong family bonds. These gentle giants use their versatile trunks for various tasks, from drinking and feeding to communicating and greeting one another. Their massive ears and wrinkled skin make them an iconic symbol of the African wilderness.
253
- 4. The colorful and flamboyant peacock, native to Asia, is known for its stunning iridescent plumage. During mating season, the males fan out their magnificent train of feathers, adorned with intricate eye-like patterns, in an elaborate courtship display to attract potential mates, making them a true spectacle of nature.
254
- 5. The sleek and powerful cheetah, the fastest land animal, is built for speed and agility. With its distinctive black tear-like markings and slender body, this feline predator can reach top speeds of up to 70 mph during short bursts, allowing it to chase down its prey with remarkable precision.
255
- 6. The playful and intelligent dolphin, a highly social marine mammal, is known for its friendly demeanor and impressive acrobatic abilities. These aquatic creatures use echolocation to navigate and hunt, and their complex communication systems have long fascinated researchers studying their intricate social structures and cognitive abilities.
256
- 7. The majestic bald eagle, the national emblem of the United States, soars high above with its distinctive white head and tail feathers. These powerful raptors are skilled hunters, swooping down from great heights to catch fish and other prey with their sharp talons, making them an iconic symbol of strength and freedom.
257
- 8. The industrious beaver, nature's skilled engineers, are known for their remarkable ability to construct dams and lodges using their sharp incisors and webbed feet. These semiaquatic rodents play a crucial role in shaping their aquatic ecosystems, creating habitats for numerous other species while demonstrating their ingenuity and perseverance.
258
- 9. The vibrant and enchanting hummingbird, one of the smallest bird species, is a true marvel of nature. With their rapidly flapping wings and ability to hover in mid-air, these tiny feathered creatures are expert pollinators, flitting from flower to flower in search of nectar and playing a vital role in plant reproduction.
259
- 10. The majestic polar bear, the apex predator of the Arctic, is perfectly adapted to its icy environment. With its thick insulating fur and specialized paws for gripping the ice, this powerful carnivore relies on its exceptional hunting skills and keen senses to locate and capture seals, its primary prey, in the harsh Arctic landscape.
 
260
  """
261
 
262
  def make_demo():
 
246
  affinity_focal_gamma, num_sample_ncut, knn_ncut, embedding_method,
247
  num_sample_tsne, knn_tsne, perplexity, n_neighbors, min_dist, sampling_method)
248
 
249
+ # lines = \
250
+ # """1. The majestic giraffe, with its towering height and distinctive long neck, roams the savannas of Africa. These gentle giants use their elongated tongues to pluck leaves from the tallest trees, making them well-adapted to their environment. Their unique coat patterns, much like human fingerprints, are unique to each individual.
251
+ # 2. Penguins, the tuxedoed birds of the Antarctic, are expert swimmers and divers. These flightless seabirds rely on their dense, waterproof feathers and streamlined bodies to propel through icy waters in search of fish, krill, and other marine life. Their huddled colonies and amusing waddles make them a favorite among wildlife enthusiasts.
252
+ # 3. The mighty African elephant, the largest land mammal, is revered for its intelligence and strong family bonds. These gentle giants use their versatile trunks for various tasks, from drinking and feeding to communicating and greeting one another. Their massive ears and wrinkled skin make them an iconic symbol of the African wilderness.
253
+ # 4. The colorful and flamboyant peacock, native to Asia, is known for its stunning iridescent plumage. During mating season, the males fan out their magnificent train of feathers, adorned with intricate eye-like patterns, in an elaborate courtship display to attract potential mates, making them a true spectacle of nature.
254
+ # 5. The sleek and powerful cheetah, the fastest land animal, is built for speed and agility. With its distinctive black tear-like markings and slender body, this feline predator can reach top speeds of up to 70 mph during short bursts, allowing it to chase down its prey with remarkable precision.
255
+ # 6. The playful and intelligent dolphin, a highly social marine mammal, is known for its friendly demeanor and impressive acrobatic abilities. These aquatic creatures use echolocation to navigate and hunt, and their complex communication systems have long fascinated researchers studying their intricate social structures and cognitive abilities.
256
+ # 7. The majestic bald eagle, the national emblem of the United States, soars high above with its distinctive white head and tail feathers. These powerful raptors are skilled hunters, swooping down from great heights to catch fish and other prey with their sharp talons, making them an iconic symbol of strength and freedom.
257
+ # 8. The industrious beaver, nature's skilled engineers, are known for their remarkable ability to construct dams and lodges using their sharp incisors and webbed feet. These semiaquatic rodents play a crucial role in shaping their aquatic ecosystems, creating habitats for numerous other species while demonstrating their ingenuity and perseverance.
258
+ # 9. The vibrant and enchanting hummingbird, one of the smallest bird species, is a true marvel of nature. With their rapidly flapping wings and ability to hover in mid-air, these tiny feathered creatures are expert pollinators, flitting from flower to flower in search of nectar and playing a vital role in plant reproduction.
259
+ # 10. The majestic polar bear, the apex predator of the Arctic, is perfectly adapted to its icy environment. With its thick insulating fur and specialized paws for gripping the ice, this powerful carnivore relies on its exceptional hunting skills and keen senses to locate and capture seals, its primary prey, in the harsh Arctic landscape.
260
+ # """
261
  lines = \
262
+ """
263
+ def transform_image(image, resolution=(1024, 1024)):
264
+ image = image.convert('RGB').resize(resolution, Image.LANCZOS)
265
+ # Convert to torch tensor
266
+ image = torch.tensor(np.array(image).transpose(2, 0, 1)).float()
267
+ image = image / 255
268
+ # Normalize
269
+ mean = [0.485, 0.456, 0.406]
270
+ std = [0.229, 0.224, 0.225]
271
+ image = (image - torch.tensor(mean).view(3, 1, 1)) / torch.tensor(std).view(3, 1, 1)
272
+ return image
273
  """
274
 
275
  def make_demo():