Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -40,11 +40,12 @@ def predict(mask):
|
|
40 |
# Get the color map by name:
|
41 |
cm = matplotlib.pyplot.get_cmap('RdBu')
|
42 |
|
43 |
-
|
44 |
-
|
|
|
45 |
v = model1.predict(X)
|
46 |
-
output = (
|
47 |
-
return cm(output[0, :, :, 0]), cm(output[0, :, :, 1]), cm(output[0, :, :, 2])
|
48 |
|
49 |
with gradio.Blocks() as demo:
|
50 |
|
@@ -68,4 +69,4 @@ with gradio.Blocks() as demo:
|
|
68 |
|
69 |
btn.click(fn=predict, inputs=[mask], outputs=[exx, eyy, exy])
|
70 |
|
71 |
-
demo.launch()
|
|
|
40 |
# Get the color map by name:
|
41 |
cm = matplotlib.pyplot.get_cmap('RdBu')
|
42 |
|
43 |
+
scaled_mask = numpy.round(scale(mask, 101, 636)/255.0)
|
44 |
+
print(scaled_mask)
|
45 |
+
X = scaled_mask[numpy.newaxis, :, :, numpy.newaxis]
|
46 |
v = model1.predict(X)
|
47 |
+
output = (v / max(v.max(), -v.min()))
|
48 |
+
return cm((numpy.multiply(output[0, :, :, 0], scaled_mask)+1.0)/2.0), cm((numpy.multiply(output[0, :, :, 1], scaled_mask)+1.0)/2.0), cm((numpy.multiply(output[0, :, :, 2], scaled_mask)+1.0)/2.0)
|
49 |
|
50 |
with gradio.Blocks() as demo:
|
51 |
|
|
|
69 |
|
70 |
btn.click(fn=predict, inputs=[mask], outputs=[exx, eyy, exy])
|
71 |
|
72 |
+
demo.launch(debug=True)
|