Spaces:
Runtime error
Runtime error
import gradio as gr | |
from rouge_score import rouge_scorer | |
def calc_rouge_score(summary, reference): | |
scorer = rouge_scorer.RougeScorer(['rouge1', 'rouge2', 'rougeL', 'rougeLsum'], use_stemmer=True) | |
scores = scorer.score(summary, reference) | |
text = f"" | |
for s in scores: | |
text += f"The {s}-score is {scores[s].fmeasure}\n" | |
return text | |
iface = gr.Interface( | |
fn=calc_rouge_score, | |
inputs=["text", "text"], | |
outputs=["text"]) | |
iface.launch() | |