IbrahimHasani commited on
Commit
87045f7
·
1 Parent(s): dab8972

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -6,9 +6,16 @@ import gradio as gr
6
  processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
7
  model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
8
 
9
- def image_similarity(image: Image.Image, positive_prompt: str, negative_prompts: list):
10
 
11
- prompts = [positive_prompt] + negative_prompts
 
 
 
 
 
 
 
12
 
13
  inputs = processor(
14
  text=prompts,
 
6
  processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
7
  model = CLIPModel.from_pretrained("openai/clip-vit-base-patch32")
8
 
9
+ def image_similarity(image: Image.Image, positive_prompt: str, negative_prompts: str):
10
 
11
+ # Split the negative prompts string into a list of prompts
12
+ negative_prompts_list = negative_prompts.split(";")
13
+
14
+ # Combine positive and negative prompts into one list
15
+ prompts = [positive_prompt.strip()] + [np.strip() for np in negative_prompts_list]
16
+
17
+ # ... rest of the code
18
+
19
 
20
  inputs = processor(
21
  text=prompts,