Adonai Vera commited on
Commit
9e12bdf
·
1 Parent(s): 81702f0

Save user feedback directly in a re-training structure

Browse files
Files changed (2) hide show
  1. app.py +7 -3
  2. examples/RC.jpg +0 -0
app.py CHANGED
@@ -7,6 +7,9 @@ import os
7
 
8
  # Initialize the pipeline with your model
9
  pipe = pipeline("image-classification", model="SubterraAI/ofwat_cleaner_classification")
 
 
 
10
 
11
  def classify_image(image):
12
  # Convert the input image to PIL format
@@ -26,13 +29,14 @@ iface = gr.Interface(
26
  examples=[
27
  ["examples/CS.jpg"],
28
  ["examples/GI.jpg"],
29
- ["examples/PP.jpg"],
30
- ["examples/RC.jpg"]
31
  ],
32
  description="Upload an image to view a classification demonstration leveraging the dataset/library of images collected by WRc & Unitied Utitlies during The Water Services Regulation Authority (OFWAT) Innovation Challenge – Artificial Intelligence and Sewers. Not only can you see the initial classification, but you as the user can also inform us if the classification is correct. Your response will be used to retrain this model. The team at Subterra would like to thank all of those involved in collecting this dataset as we hope that other groups will use it to further advance technology solutions for the water industry.",
33
  title="Sewer Cleaning Classification with AI by Subterra",
34
  allow_flagging="manual",
35
- flagging_options=["obstruction", "no_obstruction"]
 
 
36
  )
37
 
38
  # Launch the interface
 
7
 
8
  # Initialize the pipeline with your model
9
  pipe = pipeline("image-classification", model="SubterraAI/ofwat_cleaner_classification")
10
+ HF_TOKEN = os.getenv('HF_TOKEN')
11
+ hf_writer = gr.HuggingFaceDatasetSaver(HF_TOKEN, "ofwat_cleaner_loop", True, separate_dirs=True)
12
+
13
 
14
  def classify_image(image):
15
  # Convert the input image to PIL format
 
29
  examples=[
30
  ["examples/CS.jpg"],
31
  ["examples/GI.jpg"],
32
+ ["examples/PP.jpg"]
 
33
  ],
34
  description="Upload an image to view a classification demonstration leveraging the dataset/library of images collected by WRc & Unitied Utitlies during The Water Services Regulation Authority (OFWAT) Innovation Challenge – Artificial Intelligence and Sewers. Not only can you see the initial classification, but you as the user can also inform us if the classification is correct. Your response will be used to retrain this model. The team at Subterra would like to thank all of those involved in collecting this dataset as we hope that other groups will use it to further advance technology solutions for the water industry.",
35
  title="Sewer Cleaning Classification with AI by Subterra",
36
  allow_flagging="manual",
37
+ flagging_options=["obstruction", "no_obstruction"],
38
+ flagging_callback=hf_writer
39
+
40
  )
41
 
42
  # Launch the interface
examples/RC.jpg DELETED
Binary file (35.4 kB)