Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
|
|
|
|
|
| 1 |
import evaluate
|
| 2 |
from evaluate.utils import launch_gradio_widget
|
| 3 |
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
import evaluate
|
| 4 |
from evaluate.utils import launch_gradio_widget
|
| 5 |
|
| 6 |
|
| 7 |
+
|
| 8 |
+
def caller(text,dataset="pubmed"):
|
| 9 |
+
metric = evaluate.load("ronaldahmed/ccl_win")
|
| 10 |
+
res = metric.compute(predictions=preds,dataset=dataset,use_aggregator=False,device="cpu",batch_size=16)
|
| 11 |
+
total = len(res["loc_coh_ccl"])
|
| 12 |
+
results = [{"coh_ccl_window":res["loc_coh_ccl"][i]} for i in range(total)]
|
| 13 |
+
res = "CCL per sample=" + str(results)
|
| 14 |
+
return res
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
gradio_app = gr.Interface(
|
| 19 |
+
caller,
|
| 20 |
+
inputs=["text","text"],
|
| 21 |
+
outputs="text",
|
| 22 |
+
title="Local Coherence Scorer (CCL)",
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
if __name__ == "__main__":
|
| 27 |
+
gradio_app.launch()
|