yangwang825 commited on
Commit
cf6bb2e
·
verified ·
1 Parent(s): 152b5cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -104,17 +104,21 @@ 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(prediction, reference):
108
  data = {
109
- "predictions": [prediction],
110
- "references":[reference]
111
  }
112
  return metric.compute(**data)
113
  # return metric.compute(**parse_gradio_data(data, gradio_input_types))
114
 
115
  iface = gr.Interface(
116
  fn=compute,
117
- inputs=["text", "text"],
 
 
 
 
118
  # inputs=gr.components.Dataframe(
119
  # headers=feature_names,
120
  # col_count=len(feature_names),
@@ -122,10 +126,7 @@ def launch_gradio_widget(metric):
122
  # datatype=json_to_string_type(gradio_input_types),
123
  # ),
124
  outputs=gr.components.Textbox(label=metric.name),
125
- description=(
126
- metric.info.description + "\nIf this is a text-based metric, make sure to wrap you input in double quotes."
127
- " Alternatively you can use a JSON-formatted list as input."
128
- ),
129
  title=f"Metric: {metric.name}",
130
  article=parse_readme(local_path / "README.md"),
131
  # TODO: load test cases and use them to populate examples
 
104
  (feature_names, feature_types) = zip(*metric.features.items())
105
  gradio_input_types = infer_gradio_input_types(feature_types)
106
 
107
+ def compute(summary, article):
108
  data = {
109
+ "summaries": [summary],
110
+ "articles":[article]
111
  }
112
  return metric.compute(**data)
113
  # return metric.compute(**parse_gradio_data(data, gradio_input_types))
114
 
115
  iface = gr.Interface(
116
  fn=compute,
117
+ # inputs=["text", "text"],
118
+ inputs=[
119
+ gr.components.Textbox(label="Summary"),
120
+ gr.components.Textbox(label="Article")
121
+ ]
122
  # inputs=gr.components.Dataframe(
123
  # headers=feature_names,
124
  # col_count=len(feature_names),
 
126
  # datatype=json_to_string_type(gradio_input_types),
127
  # ),
128
  outputs=gr.components.Textbox(label=metric.name),
129
+ description="",
 
 
 
130
  title=f"Metric: {metric.name}",
131
  article=parse_readme(local_path / "README.md"),
132
  # TODO: load test cases and use them to populate examples