johnowhitaker commited on
Commit
d6b8beb
·
1 Parent(s): a81b4f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -30,6 +30,9 @@ def generate(color, guidance_loss_scale):
30
  # Target color as RGB
31
  target_color = ImageColor.getcolor(color, "RGB")
32
 
 
 
 
33
  # Initial random x - just one image but you could add a 'num_images' argument/input to give the user control
34
  x = torch.randn(1, 3, 256, 256).to(device)
35
 
@@ -69,7 +72,7 @@ def generate(color, guidance_loss_scale):
69
 
70
  inputs = [
71
  gr.ColorPicker(label="color", value='55FFAA'), # Add any inputs you need here
72
- gr.Slider(label="guidance_scale", minimum=1, maximum=100, value=30)
73
  ]
74
  outputs = gr.Image(label="result")
75
 
@@ -78,9 +81,8 @@ demo = gr.Interface(
78
  inputs=inputs,
79
  outputs=outputs,
80
  examples=[
81
- ["#BB2266"], # You can provide some example inputs to get people started
82
  ],
83
- )
84
 
85
  if __name__ == "__main__":
86
  demo.launch()
 
30
  # Target color as RGB
31
  target_color = ImageColor.getcolor(color, "RGB")
32
 
33
+ # Rescale from (0, 255) to (0, 1)
34
+ target_color = [a/255 for a in target_color]
35
+
36
  # Initial random x - just one image but you could add a 'num_images' argument/input to give the user control
37
  x = torch.randn(1, 3, 256, 256).to(device)
38
 
 
72
 
73
  inputs = [
74
  gr.ColorPicker(label="color", value='55FFAA'), # Add any inputs you need here
75
+ gr.Slider(label="guidance_scale", minimum=0, maximum=30, value=3)
76
  ]
77
  outputs = gr.Image(label="result")
78
 
 
81
  inputs=inputs,
82
  outputs=outputs,
83
  examples=[
84
+ ["#BB2266"],["#44CCAA"] # You can provide some example inputs to get people started
85
  ],
 
86
 
87
  if __name__ == "__main__":
88
  demo.launch()