aagoluoglu commited on
Commit
48b683e
·
verified ·
1 Parent(s): 1154a94

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -206,13 +206,21 @@ def server(input: Inputs, output: Outputs, session: Session):
206
  if input.tile_image() is not None:
207
  return process_image()
208
  else:
209
- return None
210
 
211
  @output
212
  @render.plot
213
  def prediction_plots():
214
  # get prediction results when image is uploaded
215
  image, prob, prediction = get_predictions()
 
 
 
 
 
 
 
 
216
 
217
  fig, axes = plt.subplots(1, 4, figsize=(15, 5))
218
 
 
206
  if input.tile_image() is not None:
207
  return process_image()
208
  else:
209
+ return None, None, None
210
 
211
  @output
212
  @render.plot
213
  def prediction_plots():
214
  # get prediction results when image is uploaded
215
  image, prob, prediction = get_predictions()
216
+
217
+ # Check if there are no predictions (i.e., no uploaded image)
218
+ if processed_image is None or prob is None or prediction is None:
219
+ # Return a placeholder plot or message
220
+ fig, ax = plt.subplots()
221
+ ax.text(0.5, 0.5, "Upload an image to see predictions", fontsize=12, ha="center")
222
+ ax.axis("off") # Hide axis
223
+ return fig
224
 
225
  fig, axes = plt.subplots(1, 4, figsize=(15, 5))
226