nostalgebraist commited on
Commit
1b3b3ce
·
1 Parent(s): 2d98384
Files changed (1) hide show
  1. app.py +6 -10
app.py CHANGED
@@ -62,10 +62,10 @@ def setup():
62
  pipeline = improved_diffusion.pipeline.SamplingPipeline(sampling_model_sres1, sampling_model_sres2)
63
  return pipeline
64
 
 
65
  def handler(text, ts1, ts2, gs1):
66
  pipeline = setup()
67
 
68
- # a = np.random.randint(0, 255, (128, 128, 3)).astype(np.uint8)
69
  data = {'text': text[:380], 'guidance_scale': gs1}
70
  args = {k: v for k, v in DIFFUSION_DEFAULTS.items()}
71
  args.update(data)
@@ -80,16 +80,16 @@ def handler(text, ts1, ts2, gs1):
80
 
81
  text = st.text_area('Enter your text here (or leave blank for a textless image)', max_chars=380)
82
 
83
- help_ts1 = "foo"
84
- help_ts2 = "bar " * 40
85
- help_gs1 = "aaff"
86
 
87
  ts1 = st.slider('Steps (base)', min_value=5, max_value=500, value=10, help=help_ts1)
88
  ts2 = st.slider('Steps (upsampling)', min_value=5, max_value=500, value=10, help=help_ts2)
89
  gs1 = st.select_slider('Guidance scale (base)', [0.5*i for i in range(9)], value=0., help=help_gs1)
90
- # ts1, ts2, gs1 = 20, 20, 0
91
 
92
- if st.button('rweerew'):
 
93
  low_res = st.empty()
94
  high_res = st.empty()
95
 
@@ -128,7 +128,3 @@ if st.button('rweerew'):
128
  with target.container():
129
  st.image([s, xs])
130
  st.write(f'{count} / {total} | {rate:.2f} seconds/frame')
131
-
132
-
133
- # x = st.slider('Select a value')
134
- # st.write(x, 'squared is', x * x)
 
62
  pipeline = improved_diffusion.pipeline.SamplingPipeline(sampling_model_sres1, sampling_model_sres2)
63
  return pipeline
64
 
65
+
66
  def handler(text, ts1, ts2, gs1):
67
  pipeline = setup()
68
 
 
69
  data = {'text': text[:380], 'guidance_scale': gs1}
70
  args = {k: v for k, v in DIFFUSION_DEFAULTS.items()}
71
  args.update(data)
 
80
 
81
  text = st.text_area('Enter your text here (or leave blank for a textless image)', max_chars=380)
82
 
83
+ help_ts1 = "How long to run the base model. Larger values make the image more realistic / better. Smaller values are faster."
84
+ help_ts2 = "How long to run the upsampling model. Larger values sometimes make the big image crisper and more detailed. Smaller values are faster."
85
+ help_gs1 = "Guidance scale. Larger values make the image more likely to contain the text you wrote. If this is zero, the first part will be faster."
86
 
87
  ts1 = st.slider('Steps (base)', min_value=5, max_value=500, value=10, help=help_ts1)
88
  ts2 = st.slider('Steps (upsampling)', min_value=5, max_value=500, value=10, help=help_ts2)
89
  gs1 = st.select_slider('Guidance scale (base)', [0.5*i for i in range(9)], value=0., help=help_gs1)
 
90
 
91
+
92
+ if st.button('Generate'):
93
  low_res = st.empty()
94
  high_res = st.empty()
95
 
 
128
  with target.container():
129
  st.image([s, xs])
130
  st.write(f'{count} / {total} | {rate:.2f} seconds/frame')