keplersj commited on
Commit
42524e6
·
1 Parent(s): 2b7da59
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -7,16 +7,22 @@ processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-larg
7
  model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large")
8
  pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4")
9
 
10
- file_name = st.file_uploader("Upload image 1")
 
11
 
12
- if file_name is not None:
13
  image = Image.open(file_name)
 
14
 
15
  inputs = processor(image, return_tensors="pt")
16
 
17
  out = model.generate(**inputs)
18
  description = processor.decode(out[0], skip_special_tokens=True)
 
19
  st.write(description)
20
-
21
- image = pipe(description).images[0]
22
- st.image(image)
 
 
 
 
7
  model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large")
8
  pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4")
9
 
10
+ files = st.file_uploader("Upload images to blend", accept_multiple_files=True)
11
+ descs = []
12
 
13
+ for file_name in files:
14
  image = Image.open(file_name)
15
+ st.image(image)
16
 
17
  inputs = processor(image, return_tensors="pt")
18
 
19
  out = model.generate(**inputs)
20
  description = processor.decode(out[0], skip_special_tokens=True)
21
+ descs.append(description)
22
  st.write(description)
23
+
24
+ if descs.count() > 0:
25
+ description = ' '.join(descs)
26
+ st.write(description)
27
+ for image in pipe(description):
28
+ st.image(image)