astrosbd commited on
Commit
158a705
·
verified ·
1 Parent(s): 827d2e8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -805,8 +805,8 @@ def create_gradio_interface():
805
  json_output = gr.JSON(label="API Response Data")
806
 
807
  # Event handler for analysis
808
- def process_and_display(image, damage_thresh, ai_thresh):
809
- """Process image and display results"""
810
  if image is None:
811
  return (
812
  "❌ Please upload an image",
@@ -815,8 +815,12 @@ def create_gradio_interface():
815
  get_usage_display_html(0)
816
  )
817
 
818
- # Get analysis results
819
- results = analyze_with_status(image, damage_thresh, ai_thresh)
 
 
 
 
820
 
821
  # Extract visualization and text
822
  if results["success"]:
@@ -848,7 +852,7 @@ def create_gradio_interface():
848
 
849
  analyze_btn.click(
850
  fn=process_and_display,
851
- inputs=[input_image, damage_threshold, ai_detection_threshold],
852
  outputs=[result_text, result_image, json_output, usage_display],
853
  api_name="analyze_with_status" # This makes it accessible via API
854
  )
 
805
  json_output = gr.JSON(label="API Response Data")
806
 
807
  # Event handler for analysis
808
+ def process_and_display(image):
809
+ """Process image and display results with default thresholds"""
810
  if image is None:
811
  return (
812
  "❌ Please upload an image",
 
815
  get_usage_display_html(0)
816
  )
817
 
818
+ # Use default threshold values
819
+ default_damage_threshold = 0.7
820
+ default_ai_threshold = 0.5
821
+
822
+ # Get analysis results with default thresholds
823
+ results = analyze_with_status(image, default_damage_threshold, default_ai_threshold)
824
 
825
  # Extract visualization and text
826
  if results["success"]:
 
852
 
853
  analyze_btn.click(
854
  fn=process_and_display,
855
+ inputs=[input_image], # Only image input
856
  outputs=[result_text, result_image, json_output, usage_display],
857
  api_name="analyze_with_status" # This makes it accessible via API
858
  )