nigeljw commited on
Commit
88162b6
1 Parent(s): 2fe21c0

Added basic control flow

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -1,16 +1,21 @@
1
- import streamlit as st
2
  from diffusers import StableDiffusionPipeline
3
  import torch
4
 
5
  model_id = "dream-textures/texture-diffusion"
6
 
7
- pipe = StableDiffusionPipeline.from_pretrained(model_id) #, torch_dtype=torch.float16)
8
- #pipe = pipe.to("cuda")
 
 
 
9
 
10
- prompt = "pbr brick wall"
11
- image = pipe(prompt).images[0]
12
-
 
 
13
  image.save("bricks.png")
14
 
15
- x = st.slider('Select a value')
16
- st.write(x, 'squared is', x * x)
 
1
+ import streamlit
2
  from diffusers import StableDiffusionPipeline
3
  import torch
4
 
5
  model_id = "dream-textures/texture-diffusion"
6
 
7
+ if torch.cuda.is_available():
8
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
9
+ pipe = pipe.to("cuda")
10
+ else:
11
+ pipe = StableDiffusionPipeline.from_pretrained(model_id)
12
 
13
+ examplePrompt = "pbr brick wall"
14
+ streamlit.title("Texel Space Interpolation")
15
+ prompt = streamlit.text_input(label="Prompt", value=examplePrompt)
16
+
17
+ image = pipe(prompt).images[0]
18
  image.save("bricks.png")
19
 
20
+ #x = streamlit.slider('Select a value')
21
+ #streamlit.write(x, 'squared is', x * x)