lyimo commited on
Commit
b940cb3
Β·
verified Β·
1 Parent(s): 570d35a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -12
app.py CHANGED
@@ -148,7 +148,7 @@ def process_and_analyze_image(image):
148
  analyzer = SAMAnalyzer(model_path=MODEL_PATH)
149
 
150
  print("Processing image...")
151
- veg_index, health_analysis, viz_plot = analyzer.process_image(image)
152
 
153
  if veg_index is None:
154
  return None, "Error processing image.", "Image processing failed"
@@ -164,12 +164,10 @@ def process_and_analyze_image(image):
164
  β€’ High Vegetation: {health_analysis['health_distribution']['high_vegetation']*100:.1f}%
165
 
166
  πŸ“‹ Overall Health Status: {health_analysis['overall_health']}
167
-
168
- Note: Analysis uses SAM2 for farmland segmentation
169
  """
170
 
171
  debug_msg = "Analysis completed successfully"
172
- return viz_plot, analysis_text, debug_msg
173
 
174
  except Exception as e:
175
  error_msg = f"Error during analysis: {str(e)}"
@@ -344,14 +342,15 @@ with gr.Blocks(theme=gr.themes.Base()) as demo:
344
  analyze_image_button = gr.Button("πŸ” Analyze Image", variant="primary")
345
 
346
  with gr.Row():
347
- with gr.Column():
348
- image_plot = gr.Plot(label="Vegetation Analysis Results")
349
- with gr.Column():
350
- image_analysis = gr.Textbox(
351
- label="Analysis Results",
352
- lines=10,
353
- show_label=False
354
- )
 
355
 
356
  debug_output = gr.Textbox(
357
  label="Debug Information",
 
148
  analyzer = SAMAnalyzer(model_path=MODEL_PATH)
149
 
150
  print("Processing image...")
151
+ veg_index, health_analysis, fig = analyzer.process_image(image)
152
 
153
  if veg_index is None:
154
  return None, "Error processing image.", "Image processing failed"
 
164
  β€’ High Vegetation: {health_analysis['health_distribution']['high_vegetation']*100:.1f}%
165
 
166
  πŸ“‹ Overall Health Status: {health_analysis['overall_health']}
 
 
167
  """
168
 
169
  debug_msg = "Analysis completed successfully"
170
+ return fig, analysis_text, debug_msg
171
 
172
  except Exception as e:
173
  error_msg = f"Error during analysis: {str(e)}"
 
342
  analyze_image_button = gr.Button("πŸ” Analyze Image", variant="primary")
343
 
344
  with gr.Row():
345
+ image_plot = gr.Plot(
346
+ label="Vegetation Analysis Results"
347
+ )
348
+
349
+ with gr.Row():
350
+ image_analysis = gr.Textbox(
351
+ label="Analysis Results",
352
+ lines=10
353
+ )
354
 
355
  debug_output = gr.Textbox(
356
  label="Debug Information",