crylake commited on
Commit
0ca458a
1 Parent(s): bd42647
Files changed (4) hide show
  1. app.py +2 -3
  2. pipeline.py +2 -2
  3. query2labels/infer.py +2 -2
  4. requirements.txt +1 -2
app.py CHANGED
@@ -3,7 +3,6 @@ from ulti import *
3
  import threading
4
  import pipeline
5
  import streamlit as st
6
- import numpy as np
7
  from PIL import Image
8
 
9
 
@@ -24,8 +23,8 @@ def main():
24
  if img_file_buffer is not None:
25
  from PIL import Image
26
  col1, col2 = st.columns(2)
27
- image = Image.open(img_file_buffer)
28
- image = np.array(image)
29
  # image = adjust_gamma(image, gamma=gamma)
30
  with col1:
31
  st.image(image)
 
3
  import threading
4
  import pipeline
5
  import streamlit as st
 
6
  from PIL import Image
7
 
8
 
 
23
  if img_file_buffer is not None:
24
  from PIL import Image
25
  col1, col2 = st.columns(2)
26
+ image = Image.open(img_file_buffer).convert("RGB")
27
+ #image = np.array(image)
28
  # image = adjust_gamma(image, gamma=gamma)
29
  with col1:
30
  st.image(image)
pipeline.py CHANGED
@@ -24,8 +24,8 @@ poem = pipeline('text-generation', model="./GPT2/rkw_4sen",
24
  config=config)
25
 
26
 
27
- def main(img_path):
28
- clses = vis_extractor.predict(img_path)
29
 
30
  keywords = clses
31
  print(keywords)
 
24
  config=config)
25
 
26
 
27
+ def main(img):
28
+ clses = vis_extractor.predict(img)
29
 
30
  keywords = clses
31
  print(keywords)
query2labels/infer.py CHANGED
@@ -216,8 +216,8 @@ class Query2Label():
216
  return
217
 
218
  @torch.no_grad()
219
- def predict(self, image_path):
220
- image = Image.open(image_path).convert("RGB")
221
  test_data_transform = transforms.Compose([
222
  transforms.Resize((self.args.img_size, self.args.img_size)),
223
  transforms.ToTensor()])
 
216
  return
217
 
218
  @torch.no_grad()
219
+ def predict(self, image):
220
+ #image = Image.open(image_path).convert("RGB")
221
  test_data_transform = transforms.Compose([
222
  transforms.Resize((self.args.img_size, self.args.img_size)),
223
  transforms.ToTensor()])
requirements.txt CHANGED
@@ -5,5 +5,4 @@ yapf
5
  timm
6
  transformers
7
  termcolor
8
- scipy
9
- numpy
 
5
  timm
6
  transformers
7
  termcolor
8
+ scipy