Spaces:
Runtime error
Runtime error
blender
Browse files
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 |
-
|
|
|
11 |
|
12 |
-
|
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 |
-
|
22 |
-
|
|
|
|
|
|
|
|
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)
|