VaianiLorenzo commited on
Commit
b8d9e31
1 Parent(s): 89e64c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -188,7 +188,7 @@ class CLIPDemo:
188
  def compute_image_embeddings(self, image_paths: list):
189
  self.image_paths = image_paths
190
  dataloader = DataLoader(VisionDataset(
191
- image_paths=image_paths), batch_size=self.batch_size, num_workers=8)
192
  embeddings = []
193
  with torch.no_grad():
194
 
@@ -316,7 +316,7 @@ def draw_audio(
316
  vision_encoder = CLIPVisionModel.from_pretrained(CLIP_VISION_MODEL_PATH, local_files_only=True).to(device)
317
  tokenizer = AutoTokenizer.from_pretrained(TEXT_MODEL)
318
  model = CLIPDemo(vision_encoder=vision_encoder, text_encoder=text_encoder, tokenizer=tokenizer, device=device)
319
- model.compute_image_embeddings(glob.glob(SPECTROGRAMS_PATH+"/*.jpeg")[:5000])
320
  st.session_state["model"] = model
321
  #st.session_state['model'] = CLIPDemo(vision_encoder=vision_encoder, text_encoder=text_encoder, tokenizer=tokenizer)
322
  #st.session_state.model.compute_image_embeddings(glob.glob("/data1/mlaquatra/TSOAI_hack/data/spectrograms/*.jpeg")[:100])
@@ -384,7 +384,7 @@ def draw_camera(
384
  vision_encoder = CLIPVisionModel.from_pretrained(CLIP_VISION_MODEL_PATH, local_files_only=True).to(device)
385
  tokenizer = AutoTokenizer.from_pretrained(TEXT_MODEL)
386
  model = CLIPDemo(vision_encoder=vision_encoder, text_encoder=text_encoder, tokenizer=tokenizer, device=device)
387
- model.compute_image_embeddings(glob.glob(SPECTROGRAMS_PATH + "/*.jpeg")[:5000])
388
  st.session_state["model"] = model
389
  #st.session_state['model'] = CLIPDemo(vision_encoder=vision_encoder, text_encoder=text_encoder, tokenizer=tokenizer)
390
  #st.session_state.model.compute_image_embeddings(glob.glob("/data1/mlaquatra/TSOAI_hack/data/spectrograms/*.jpeg")[:100])
 
188
  def compute_image_embeddings(self, image_paths: list):
189
  self.image_paths = image_paths
190
  dataloader = DataLoader(VisionDataset(
191
+ image_paths=image_paths), batch_size=self.batch_size)
192
  embeddings = []
193
  with torch.no_grad():
194
 
 
316
  vision_encoder = CLIPVisionModel.from_pretrained(CLIP_VISION_MODEL_PATH, local_files_only=True).to(device)
317
  tokenizer = AutoTokenizer.from_pretrained(TEXT_MODEL)
318
  model = CLIPDemo(vision_encoder=vision_encoder, text_encoder=text_encoder, tokenizer=tokenizer, device=device)
319
+ model.compute_image_embeddings(glob.glob(SPECTROGRAMS_PATH+"/*.jpeg")[:1000])
320
  st.session_state["model"] = model
321
  #st.session_state['model'] = CLIPDemo(vision_encoder=vision_encoder, text_encoder=text_encoder, tokenizer=tokenizer)
322
  #st.session_state.model.compute_image_embeddings(glob.glob("/data1/mlaquatra/TSOAI_hack/data/spectrograms/*.jpeg")[:100])
 
384
  vision_encoder = CLIPVisionModel.from_pretrained(CLIP_VISION_MODEL_PATH, local_files_only=True).to(device)
385
  tokenizer = AutoTokenizer.from_pretrained(TEXT_MODEL)
386
  model = CLIPDemo(vision_encoder=vision_encoder, text_encoder=text_encoder, tokenizer=tokenizer, device=device)
387
+ model.compute_image_embeddings(glob.glob(SPECTROGRAMS_PATH + "/*.jpeg")[:1000])
388
  st.session_state["model"] = model
389
  #st.session_state['model'] = CLIPDemo(vision_encoder=vision_encoder, text_encoder=text_encoder, tokenizer=tokenizer)
390
  #st.session_state.model.compute_image_embeddings(glob.glob("/data1/mlaquatra/TSOAI_hack/data/spectrograms/*.jpeg")[:100])