Spaces:
Runtime error
Runtime error
Heiko Hotz
commited on
Commit
·
6f26bdf
1
Parent(s):
63efbc9
Add application file
Browse files
app.py
CHANGED
@@ -2,12 +2,16 @@ import gradio as gr
|
|
2 |
from rouge_score import rouge_scorer
|
3 |
|
4 |
def calc_rouge_score(summary, reference):
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
8 |
|
9 |
iface = gr.Interface(
|
10 |
fn=calc_rouge_score,
|
11 |
inputs=["text", "text"],
|
12 |
-
outputs=["text"
|
13 |
iface.launch()
|
|
|
2 |
from rouge_score import rouge_scorer
|
3 |
|
4 |
def calc_rouge_score(summary, reference):
|
5 |
+
scorer = rouge_scorer.RougeScorer(['rouge1', 'rouge2', 'rougeL', 'rougeLsum'], use_stemmer=True)
|
6 |
+
scores = scorer.score(summary, reference)
|
7 |
+
|
8 |
+
text = f""
|
9 |
+
for s in scores:
|
10 |
+
text += f"The {s}-score is {scores[s].fmeasure}\n"
|
11 |
+
return text
|
12 |
|
13 |
iface = gr.Interface(
|
14 |
fn=calc_rouge_score,
|
15 |
inputs=["text", "text"],
|
16 |
+
outputs=["text"])
|
17 |
iface.launch()
|