danielritchie commited on
Commit
fb07755
·
verified ·
1 Parent(s): d50eb79

Update utils/color_model.py

Browse files
Files changed (1) hide show
  1. utils/color_model.py +9 -2
utils/color_model.py CHANGED
@@ -88,15 +88,22 @@ def apply_cinematic_blend(model_output, drama):
88
  # Render HTML Block
89
  # -------------------------------------------------
90
 
91
- def render_color(rgb):
 
 
 
 
 
 
92
  return f"""
93
  <div style="
94
  width:100%;
95
  height:240px;
96
  border-radius:18px;
97
- background: rgb({rgb['R']},{rgb['G']},{rgb['B']});
98
  box-shadow: 0px 6px 32px rgba(0,0,0,0.25);
99
  transition: all 0.35s cubic-bezier(.4,0,.2,1);
100
  "></div>
101
  """
102
 
 
 
88
  # Render HTML Block
89
  # -------------------------------------------------
90
 
91
+ def render_color(model_output):
92
+
93
+ # Convert 0–1 floats to 0–255 integers
94
+ r = int(max(0, min(255, model_output["R"] * 255)))
95
+ g = int(max(0, min(255, model_output["G"] * 255)))
96
+ b = int(max(0, min(255, model_output["B"] * 255)))
97
+
98
  return f"""
99
  <div style="
100
  width:100%;
101
  height:240px;
102
  border-radius:18px;
103
+ background: rgb({r},{g},{b});
104
  box-shadow: 0px 6px 32px rgba(0,0,0,0.25);
105
  transition: all 0.35s cubic-bezier(.4,0,.2,1);
106
  "></div>
107
  """
108
 
109
+