syaikhipin commited on
Commit
51aa767
·
1 Parent(s): 9d79106

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -8,7 +8,8 @@ Original file is located at
8
  """
9
 
10
  #install dependencies
11
-
 
12
 
13
  #import library
14
  import gradio as gr
@@ -40,8 +41,8 @@ def calculate_corrosion_areas(json_data, unit="pixels", conversion_factor=1):
40
  if prediction["class"] == "Corrosion":
41
  points = [(point["x"], point["y"]) for point in prediction["points"]]
42
  area = calculate_polygon_area(points)
43
- if unit == "cm²":
44
- area *= conversion_factor # Convert area from pixels to cm²
45
  corrosion_areas.append(area)
46
 
47
  total_corrosion_area = sum(corrosion_areas)
@@ -98,7 +99,7 @@ iface = gr.Interface(
98
  inputs=[
99
  gr.inputs.Textbox(label="Enter the URL of an image"),
100
  gr.inputs.Textbox(label="Enter the Location"),
101
- gr.inputs.Dropdown(choices=["pixels", "cm²"], label="Area Unit"),
102
  gr.inputs.Textbox(label="Conversion Factor")
103
  ],
104
  outputs=[gr.outputs.Image(type="pil"), "json", "json"],
 
8
  """
9
 
10
  #install dependencies
11
+ #!pip install roboflow
12
+ #!pip install gradio
13
 
14
  #import library
15
  import gradio as gr
 
41
  if prediction["class"] == "Corrosion":
42
  points = [(point["x"], point["y"]) for point in prediction["points"]]
43
  area = calculate_polygon_area(points)
44
+ if unit == "cm??":
45
+ area *= conversion_factor # Convert area from pixels to cm??
46
  corrosion_areas.append(area)
47
 
48
  total_corrosion_area = sum(corrosion_areas)
 
99
  inputs=[
100
  gr.inputs.Textbox(label="Enter the URL of an image"),
101
  gr.inputs.Textbox(label="Enter the Location"),
102
+ gr.inputs.Dropdown(choices=["pixels", "cm??"], label="Area Unit"),
103
  gr.inputs.Textbox(label="Conversion Factor")
104
  ],
105
  outputs=[gr.outputs.Image(type="pil"), "json", "json"],