jordyvl commited on
Commit
543b514
1 Parent(s): 9182e7b

update for app definition, can load locally for testing

Browse files
Files changed (2) hide show
  1. app.py +19 -1
  2. ece.py +8 -2
app.py CHANGED
@@ -1,7 +1,25 @@
1
  import evaluate
2
  from evaluate.utils import launch_gradio_widget
3
 
4
-
5
  module = evaluate.load("jordyvl/ece")
6
  launch_gradio_widget(module)
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import evaluate
2
  from evaluate.utils import launch_gradio_widget
3
 
 
4
  module = evaluate.load("jordyvl/ece")
5
  launch_gradio_widget(module)
6
 
7
+ """
8
+ import gradio as gr
9
+
10
+ metric = ECE()
11
+
12
+ iface = gr.Interface(
13
+ fn=compute,
14
+ inputs=gr.inputs.Dataframe(headers=["predictions", "references"], col_width=2, datatype="number"),
15
+ outputs=gr.outputs.Textbox(label="accuracy"),
16
+ description=metric.info.description,
17
+ article=metric.info.citation,
18
+ )
19
+
20
+ iface.launch()
21
+
22
+ #might be nice to also plot reliability diagram
23
+
24
+ have sliders for kwargs :)
25
+ """
ece.py CHANGED
@@ -209,8 +209,10 @@ class ECE(evaluate.EvaluationModule):
209
  4. apply L^p norm distance and weights
210
  """
211
 
212
- def __init__(self, n_bins=10, bin_range=None, scheme="equal-range", proxy="upper-edge", p=1):
213
- super().__init__()
 
 
214
  self.n_bins = n_bins
215
  self.bin_range = bin_range
216
  self.scheme = scheme
@@ -274,3 +276,7 @@ def test_ECE():
274
 
275
  if __name__ == "__main__":
276
  test_ECE()
 
 
 
 
 
209
  4. apply L^p norm distance and weights
210
  """
211
 
212
+ def __init__(self, n_bins=10, bin_range=None, scheme="equal-range", proxy="upper-edge", p=1, **kwargs):
213
+ import pdb; pdb.set_trace() # breakpoint bf1c56c7 //
214
+
215
+ super(evaluate.EvaluationModule, self).__init__(**kwargs)
216
  self.n_bins = n_bins
217
  self.bin_range = bin_range
218
  self.scheme = scheme
 
276
 
277
  if __name__ == "__main__":
278
  test_ECE()
279
+
280
+ evaluate.load("jordyvl/ece")
281
+ import pdb; pdb.set_trace() # breakpoint 058892ee //
282
+