Spaces:
Runtime error
Runtime error
Update app.py
Browse filesHello! App developed by Khalid!
app.py
CHANGED
@@ -135,7 +135,6 @@ def img_preprocess(image, h, w):
|
|
135 |
|
136 |
def patch_stiching(flooded_image, h, w, x0, y0): # ((x0, y0) = center of channel, (w1, h1) = height and width of patch)
|
137 |
flow_field_updated = np.copy(flow_field)
|
138 |
-
print('flow field updated - ', flow_field_updated[:,-1])
|
139 |
flow_field_updated[int(x0-w/2):int(x0+w/2),int(y0-h/2):int(y0+h/2)] = flooded_image
|
140 |
|
141 |
|
@@ -204,9 +203,6 @@ def fill_shape_with_pixels(img): #img is taken by gradio as uint8
|
|
204 |
v_profile = v_pred[0][:,:,0]
|
205 |
p_profile = p_pred[0][:,:,0]
|
206 |
p_profile[p_profile>0.02] = 0.02
|
207 |
-
hist, bins = np.histogram(p_profile, bins=20)
|
208 |
-
print(hist)
|
209 |
-
print(bins)
|
210 |
|
211 |
# Creating a copy of the above profiles-
|
212 |
u_profile_dash = np.copy(u_profile)
|
@@ -231,7 +227,7 @@ def fill_shape_with_pixels(img): #img is taken by gradio as uint8
|
|
231 |
velocity = np.sqrt(u_profile_dash_1**2 + v_profile_dash_1**2)
|
232 |
ax = plt.subplot()
|
233 |
ax.imshow(velocity, cmap = 'gray', extent = (0,256, 0,128))
|
234 |
-
q = ax.quiver(X[5::
|
235 |
ax.quiverkey(q, X=0.9, Y=1.07, U=2,
|
236 |
label='m/s', labelpos='E')
|
237 |
plt.title("Velocity distribution", fontsize = 11)
|
|
|
135 |
|
136 |
def patch_stiching(flooded_image, h, w, x0, y0): # ((x0, y0) = center of channel, (w1, h1) = height and width of patch)
|
137 |
flow_field_updated = np.copy(flow_field)
|
|
|
138 |
flow_field_updated[int(x0-w/2):int(x0+w/2),int(y0-h/2):int(y0+h/2)] = flooded_image
|
139 |
|
140 |
|
|
|
203 |
v_profile = v_pred[0][:,:,0]
|
204 |
p_profile = p_pred[0][:,:,0]
|
205 |
p_profile[p_profile>0.02] = 0.02
|
|
|
|
|
|
|
206 |
|
207 |
# Creating a copy of the above profiles-
|
208 |
u_profile_dash = np.copy(u_profile)
|
|
|
227 |
velocity = np.sqrt(u_profile_dash_1**2 + v_profile_dash_1**2)
|
228 |
ax = plt.subplot()
|
229 |
ax.imshow(velocity, cmap = 'gray', extent = (0,256, 0,128))
|
230 |
+
q = ax.quiver(X[5::7,5::7], Y[5::7,5::7], u_profile_dash[5::7,5::7], v_profile_dash[5::7,5::7], pivot = 'middle', color = 'red')
|
231 |
ax.quiverkey(q, X=0.9, Y=1.07, U=2,
|
232 |
label='m/s', labelpos='E')
|
233 |
plt.title("Velocity distribution", fontsize = 11)
|