Spaces:
Runtime error
Runtime error
Commit ·
fc409ef
1
Parent(s): e00157f
try to change maximum on the fly
Browse files
app.py
CHANGED
|
@@ -138,11 +138,13 @@ if __name__ == "__main__":
|
|
| 138 |
def update_scale(width:int, height:int, image: np.ndarray):
|
| 139 |
|
| 140 |
widthImage, heightImage = image.shape[:2]
|
| 141 |
-
|
|
|
|
| 142 |
return {
|
| 143 |
-
maxScale:
|
| 144 |
}
|
| 145 |
image.change(fn=update_scale, inputs=[width, height, image], outputs=[maxScale])
|
|
|
|
| 146 |
fit.click(fn=process, inputs=[width, height, scale, image], outputs=[plot_output, total])
|
| 147 |
|
| 148 |
|
|
|
|
| 138 |
def update_scale(width:int, height:int, image: np.ndarray):
|
| 139 |
|
| 140 |
widthImage, heightImage = image.shape[:2]
|
| 141 |
+
scaler = int((width/widthImage + height/heightImage)/2)
|
| 142 |
+
scale.maximum = scaler
|
| 143 |
return {
|
| 144 |
+
maxScale: scaler
|
| 145 |
}
|
| 146 |
image.change(fn=update_scale, inputs=[width, height, image], outputs=[maxScale])
|
| 147 |
+
|
| 148 |
fit.click(fn=process, inputs=[width, height, scale, image], outputs=[plot_output, total])
|
| 149 |
|
| 150 |
|