Spaces:
Runtime error
Runtime error
update
Browse files
app.py
CHANGED
@@ -1,4 +1,22 @@
|
|
1 |
import streamlit as st
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
x = st.slider('Select a value')
|
4 |
st.write(x, 'squared is', x * x)
|
|
|
1 |
import streamlit as st
|
2 |
|
3 |
+
import torch
|
4 |
+
from transformers import AutoImageProcessor, Mask2FormerForUniversalSegmentation
|
5 |
+
from diffusers import StableDiffusionInpaintPipeline
|
6 |
+
|
7 |
+
|
8 |
+
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
9 |
+
|
10 |
+
seg_processor = AutoImageProcessor.from_pretrained("facebook/mask2former-swin-base-coco-panoptic")
|
11 |
+
seg_model = Mask2FormerForUniversalSegmentation.from_pretrained("facebook/mask2former-swin-base-coco-panoptic")
|
12 |
+
|
13 |
+
|
14 |
+
# get Stable Diffusion model for image inpainting
|
15 |
+
pipe = StableDiffusionInpaintPipeline.from_pretrained(
|
16 |
+
"runwayml/stable-diffusion-inpainting",
|
17 |
+
torch_dtype=torch.float16,
|
18 |
+
).to(device)
|
19 |
+
|
20 |
+
|
21 |
x = st.slider('Select a value')
|
22 |
st.write(x, 'squared is', x * x)
|