muhtasham commited on
Commit
dba0bb7
1 Parent(s): 835af61

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -7,7 +7,7 @@ from transformers import pipeline
7
 
8
  asr = pipeline("automatic-speech-recognition")
9
  latent = gr.Interface.load("spaces/multimodalart/latentdiffusion")
10
- zero = pipeline("zero-shot-image-classification", model="openai/clip-vit-base-patch32")
11
  #zero = gr.Interface.load("spaces/Datatrooper/zero-shot-image-classification")
12
  #tts = gr.Interface.load("spaces/osanseviero/tortoisse-tts")
13
 
@@ -49,9 +49,9 @@ def zero_shot(image, text_input):
49
  return {dic["label"]: dic["score"] for dic in res}
50
 
51
  def shot(image, labels_text):
52
- #PIL_image = Image.fromarray(np.uint8(image)).convert('RGB')
53
  labels = labels_text.split(",")
54
- res = pipe(images= image,
55
  candidate_labels=labels,
56
  hypothesis_template= "This is a photo of a {}")
57
  return {dic["label"]: dic["score"] for dic in res}
 
7
 
8
  asr = pipeline("automatic-speech-recognition")
9
  latent = gr.Interface.load("spaces/multimodalart/latentdiffusion")
10
+ zero = pipeline("zero-shot-image-classification")
11
  #zero = gr.Interface.load("spaces/Datatrooper/zero-shot-image-classification")
12
  #tts = gr.Interface.load("spaces/osanseviero/tortoisse-tts")
13
 
 
49
  return {dic["label"]: dic["score"] for dic in res}
50
 
51
  def shot(image, labels_text):
52
+ PIL_image = Image.fromarray(np.uint8(image)).convert('RGB')
53
  labels = labels_text.split(",")
54
+ res = pipe(images= PIL_image,
55
  candidate_labels=labels,
56
  hypothesis_template= "This is a photo of a {}")
57
  return {dic["label"]: dic["score"] for dic in res}