hushell commited on
Commit
6464c04
1 Parent(s): bf0f567

show short version of url

Browse files
Files changed (2) hide show
  1. app.py +3 -1
  2. requirements.txt +1 -0
app.py CHANGED
@@ -10,6 +10,7 @@ import matplotlib.pyplot as plt
10
  from models import get_model
11
  from dotmap import DotMap
12
  from PIL import Image
 
13
 
14
  #os.environ['TERM'] = 'linux'
15
  #os.environ['TERMINFO'] = '/etc/terminfo'
@@ -113,8 +114,9 @@ def inference(query, labels, n_supp=10):
113
  x_im = Image.open(x.path)
114
 
115
  # vis
 
116
  axs[idx, j].imshow(x_im)
117
- axs[idx, j].set_title(f'{y}{j}:{x.path}')
118
  axs[idx, j].axis('off')
119
 
120
  x_im = preprocess(x_im) # (3, H, W)
 
10
  from models import get_model
11
  from dotmap import DotMap
12
  from PIL import Image
13
+ from pyshorteners import Shortener
14
 
15
  #os.environ['TERM'] = 'linux'
16
  #os.environ['TERMINFO'] = '/etc/terminfo'
 
114
  x_im = Image.open(x.path)
115
 
116
  # vis
117
+ url_shortener = Shortener('Bitly', bitly_token='YOUR TOKEN')
118
  axs[idx, j].imshow(x_im)
119
+ axs[idx, j].set_title(f'{y}{j}:{url_shortener}')
120
  axs[idx, j].axis('off')
121
 
122
  x_im = preprocess(x_im) # (3, H, W)
requirements.txt CHANGED
@@ -10,3 +10,4 @@ ml-collections
10
  ftfy
11
  tensorboard
12
  Google-Images-Search
 
 
10
  ftfy
11
  tensorboard
12
  Google-Images-Search
13
+ pyshorteners