John Graham Reynolds
commited on
Commit
·
a9c64ab
1
Parent(s):
6a4f85e
add temporary demo to test formatting
Browse files
app.py
CHANGED
@@ -23,28 +23,46 @@ Try to use \t to write some code? \t or how does that work? </p>
|
|
23 |
article = "<p style='text-align: center'> Check out the [original repo](https://github.com/johngrahamreynolds/FixedMetricsForHF) housing this code, and a quickly \
|
24 |
trained [multilabel text classification model](https://github.com/johngrahamreynolds/RoBERTa-base-DReiFT/tree/main) that makes use of it during evaluation.</p>"
|
25 |
|
26 |
-
def show_off(predictions: list[list]) -> str:
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
|
38 |
-
|
39 |
|
40 |
|
41 |
-
gr.Interface(
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
).launch()
|
|
|
23 |
article = "<p style='text-align: center'> Check out the [original repo](https://github.com/johngrahamreynolds/FixedMetricsForHF) housing this code, and a quickly \
|
24 |
trained [multilabel text classification model](https://github.com/johngrahamreynolds/RoBERTa-base-DReiFT/tree/main) that makes use of it during evaluation.</p>"
|
25 |
|
26 |
+
# def show_off(predictions: list[list]) -> str:
|
27 |
|
28 |
+
# # f1 = FixedF1(average=weighting_map["f1"])
|
29 |
+
# # precision = FixedPrecision(average=weighting_map["precision"])
|
30 |
+
# # recall = FixedRecall(average=weighting_map["recall"])
|
31 |
|
32 |
+
# # combined = evaluate.combine([f1, recall, precision])
|
33 |
|
34 |
+
# # combined.add_batch(prediction=predictions, reference=references)
|
35 |
+
# # outputs = combined.compute()
|
36 |
+
# outputs = predictions
|
37 |
|
38 |
+
# return "Your metrics are as follows: \n" + outputs
|
39 |
|
40 |
|
41 |
+
# gr.Interface(
|
42 |
+
# fn=show_off,
|
43 |
+
# inputs=gr.Dataframe(type="array", datatype="number", row_count=5, col_count=1),
|
44 |
+
# outputs="text",
|
45 |
+
# title=title,
|
46 |
+
# description=description,
|
47 |
+
# article=article,
|
48 |
+
# examples=[pd.DataFrame([1, 0, 2, 0, 1])],
|
49 |
+
# cache_examples=False
|
50 |
+
# ).launch()
|
51 |
+
|
52 |
+
def filter_records(records, gender):
|
53 |
+
return records[records["gender"] == gender]
|
54 |
+
|
55 |
+
demo = gr.Interface(
|
56 |
+
filter_records,
|
57 |
+
[
|
58 |
+
gr.Dataframe(
|
59 |
+
headers=["name", "age", "gender"],
|
60 |
+
datatype=["str", "number", "str"],
|
61 |
+
row_count=5,
|
62 |
+
col_count=(3, "fixed"),
|
63 |
+
),
|
64 |
+
gr.Dropdown(["M", "F", "O"]),
|
65 |
+
],
|
66 |
+
"dataframe",
|
67 |
+
description="Enter gender as 'M', 'F', or 'O' for other.",
|
68 |
).launch()
|