Spaces:
Runtime error
Runtime error
diffuse?
Browse files- app.py +7 -1
- requirements.txt +1 -1
app.py
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
import streamlit as st
|
2 |
from PIL import Image
|
3 |
from transformers import BlipProcessor, BlipForConditionalGeneration
|
|
|
4 |
|
5 |
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large")
|
6 |
model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-captioning-large")
|
|
|
7 |
|
8 |
file_name = st.file_uploader("Upload image 1")
|
9 |
|
@@ -13,4 +15,8 @@ if file_name is not None:
|
|
13 |
inputs = processor(image, return_tensors="pt")
|
14 |
|
15 |
out = model.generate(**inputs)
|
16 |
-
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from PIL import Image
|
3 |
from transformers import BlipProcessor, BlipForConditionalGeneration
|
4 |
+
from diffusers import StableDiffusionPipeline
|
5 |
|
6 |
processor = BlipProcessor.from_pretrained("Salesforce/blip-image-captioning-large")
|
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 |
|
|
|
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)
|
requirements.txt
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
transformers
|
2 |
torch
|
3 |
-
|
|
|
1 |
transformers
|
2 |
torch
|
3 |
+
diffusers
|