Spaces:
Running
Running
File size: 1,039 Bytes
6ee5ac2 3baca8d 6ee5ac2 3baca8d 8cfe2b8 3baca8d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
import evaluate
import gradio as gr
import os
module = evaluate.load("maqiuping59/table_markdown")
def compute_metrics(predictions, references):
results = module.compute(predictions=predictions, references=references)
return results
# 创建界面
demo = gr.Interface(
fn=compute_metrics,
inputs=[
gr.Textbox(label="Predictions (Markdown Table)", lines=10),
gr.Textbox(label="References (Markdown Table)", lines=10)
],
outputs=gr.JSON(label="Results"),
title="Table Markdown Metrics",
description="Evaluate the accuracy of table data extraction or generation by comparing predicted tables with reference tables.",
examples=[
[
"|A|B|\n|1|2|",
"|A|B|\n|1|3|"
],
[
"| | lobby | search | band |\n|--|-------|--------|------|\n| desire | 5 | 8 | 7 |\n| wage | 1 | 5 | 3 |",
"| | lobby | search | band |\n|--|-------|--------|------|\n| desire | 5 | 8 | 7 |\n| wage | 1 | 5 | 3 |"
]
]
)
demo.launch() |