Spaces:
Sleeping
Sleeping
yangwang825
commited on
Commit
•
0b38eef
1
Parent(s):
ac41e13
Update app.py
Browse files
app.py
CHANGED
@@ -104,17 +104,22 @@ def launch_gradio_widget(metric):
|
|
104 |
(feature_names, feature_types) = zip(*metric.features.items())
|
105 |
gradio_input_types = infer_gradio_input_types(feature_types)
|
106 |
|
107 |
-
def compute(
|
108 |
-
return metric.compute(
|
|
|
109 |
|
110 |
iface = gr.Interface(
|
111 |
-
fn=compute,
|
112 |
-
inputs=
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
|
|
|
|
|
|
|
|
118 |
outputs=gr.components.Textbox(label=metric.name),
|
119 |
description=(
|
120 |
metric.info.description + "\nIf this is a text-based metric, make sure to wrap you input in double quotes."
|
|
|
104 |
(feature_names, feature_types) = zip(*metric.features.items())
|
105 |
gradio_input_types = infer_gradio_input_types(feature_types)
|
106 |
|
107 |
+
def compute(predictions, references):
|
108 |
+
return metric.compute([predictions], [references])
|
109 |
+
# return metric.compute(**parse_gradio_data(data, gradio_input_types))
|
110 |
|
111 |
iface = gr.Interface(
|
112 |
+
fn=compute,
|
113 |
+
inputs=[
|
114 |
+
gr.components.Textbox(label="predictions"),
|
115 |
+
gr.components.Textbox(label="references")
|
116 |
+
]
|
117 |
+
# inputs=gr.components.Dataframe(
|
118 |
+
# headers=feature_names,
|
119 |
+
# col_count=len(feature_names),
|
120 |
+
# row_count=1,
|
121 |
+
# datatype=json_to_string_type(gradio_input_types),
|
122 |
+
# ),
|
123 |
outputs=gr.components.Textbox(label=metric.name),
|
124 |
description=(
|
125 |
metric.info.description + "\nIf this is a text-based metric, make sure to wrap you input in double quotes."
|