AIQuest commited on
Commit
71980fc
·
1 Parent(s): 9f58bba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -57,6 +57,26 @@ def car_detection_and_Cropping(image_path):
57
  class_c = number_object_detected(image_path)
58
  return class_c
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  ## this function will take the image url and call all the related functions
61
  def estimate_condition(detections):
62
  print("Detedtion list",detections)
@@ -101,6 +121,6 @@ def process_data(files):
101
 
102
  years_list = list(range(2024, 1899, -1))
103
  gr.Interface(fn = process_data,title = "Car Price Prediction",
104
- inputs=[gr.image(label="Upload Files", type="pil")],
105
 
106
  outputs=[gr.Textbox(label="Damage List"),gr.Textbox(label="Condition")]).launch()
 
57
  class_c = number_object_detected(image_path)
58
  return class_c
59
 
60
+ severity_points = {
61
+ 'scratch': 1,
62
+ 'dent': 2,
63
+ 'rust': 2,
64
+ 'paint-damage': 2,
65
+ 'crack':2
66
+ }
67
+
68
+ def calculate_condition_score(detections):
69
+ total_score = 0
70
+ for detection, count in detections.items():
71
+ if detection in severity_points:
72
+ total_score += severity_points[detection] * count
73
+ return total_score
74
+
75
+ def normalize_score(score, max_score):
76
+ return (score / max_score) * 10
77
+
78
+
79
+
80
  ## this function will take the image url and call all the related functions
81
  def estimate_condition(detections):
82
  print("Detedtion list",detections)
 
121
 
122
  years_list = list(range(2024, 1899, -1))
123
  gr.Interface(fn = process_data,title = "Car Price Prediction",
124
+ inputs=[gr.Image(label="Upload Files", type="pil")],
125
 
126
  outputs=[gr.Textbox(label="Damage List"),gr.Textbox(label="Condition")]).launch()