mhamilton723 commited on
Commit
4dad5d2
1 Parent(s): eaaab0d
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -6,7 +6,8 @@ import gradio as gr
6
  from featup.util import norm, unnorm, pca, remove_axes
7
  from pytorch_lightning import seed_everything
8
  import os
9
-
 
10
 
11
  def plot_feats(image, lr, hr):
12
  assert len(image.shape) == len(lr.shape) == len(hr.shape) == 3
@@ -40,9 +41,6 @@ def plot_feats(image, lr, hr):
40
 
41
 
42
  if __name__ == "__main__":
43
- import requests
44
- import os
45
-
46
 
47
  def download_image(url, save_path):
48
  response = requests.get(url)
@@ -56,7 +54,7 @@ if __name__ == "__main__":
56
  "plant.png": base_url + "plant.png",
57
  }
58
 
59
- sample_images_dir = "sample_images"
60
 
61
  # Ensure the directory for sample images exists
62
  os.makedirs(sample_images_dir, exist_ok=True)
@@ -112,9 +110,9 @@ if __name__ == "__main__":
112
  title="Feature Upsampling Demo",
113
  description="This demo allows you to upsample features of an image using selected models.",
114
  examples=[
115
- ["sample_images/skate.jpg", "dino16"],
116
- ["sample_images/car.jpg", "dinov2"],
117
- ["sample_images/plant.png", "dino16"],
118
  ]
119
 
120
  )
 
6
  from featup.util import norm, unnorm, pca, remove_axes
7
  from pytorch_lightning import seed_everything
8
  import os
9
+ import requests
10
+ import os
11
 
12
  def plot_feats(image, lr, hr):
13
  assert len(image.shape) == len(lr.shape) == len(hr.shape) == 3
 
41
 
42
 
43
  if __name__ == "__main__":
 
 
 
44
 
45
  def download_image(url, save_path):
46
  response = requests.get(url)
 
54
  "plant.png": base_url + "plant.png",
55
  }
56
 
57
+ sample_images_dir = "/tmp/sample_images"
58
 
59
  # Ensure the directory for sample images exists
60
  os.makedirs(sample_images_dir, exist_ok=True)
 
110
  title="Feature Upsampling Demo",
111
  description="This demo allows you to upsample features of an image using selected models.",
112
  examples=[
113
+ ["/tmp/sample_images/skate.jpg", "dino16"],
114
+ ["/tmp/sample_images/car.jpg", "dinov2"],
115
+ ["/tmp/sample_images/plant.png", "dino16"],
116
  ]
117
 
118
  )