File size: 641 Bytes
9f4286b
 
44622dc
 
 
 
9f4286b
 
80fc9d7
 
 
 
 
 
9f4286b
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr

import evaluate
from evaluate.utils import launch_gradio_widget



def caller(text,dataset="pubmed"):
    metric = evaluate.load("ronaldahmed/ccl_win")
    res = metric.compute(predictions=preds,dataset=dataset,use_aggregator=False,device="cpu",batch_size=16)
    total = len(res["loc_coh_ccl"])
    results = [{"coh_ccl_window":res["loc_coh_ccl"][i]} for i in range(total)] 
    res = "CCL per sample=" + str(results)
    return res



gradio_app = gr.Interface(
    caller,
    inputs=["text","text"],
    outputs="text",
    title="Local Coherence Scorer (CCL)",
)


if __name__ == "__main__":
    gradio_app.launch()