|
import gradio as gr |
|
import subprocess |
|
import sys |
|
|
|
|
|
repo_url = "https://github.com/KyuDan1/TeXBLEU.git" |
|
repo_name = "TeXBLEU" |
|
subprocess.run(["git", "clone", repo_url]) |
|
|
|
|
|
sys.path.append(repo_name) |
|
|
|
|
|
from new_metric import texbleu |
|
|
|
def calculate_texbleu(reference, candidate): |
|
|
|
result = texbleu(reference, candidate) |
|
return f"TeXBLEU Score: {result}" |
|
|
|
|
|
demo = gr.Interface( |
|
fn=calculate_texbleu, |
|
inputs=[ |
|
gr.Textbox(label="Reference Text", lines=5), |
|
gr.Textbox(label="Candidate Text", lines=5) |
|
], |
|
outputs="text", |
|
title="TeXBLEU Score Calculator", |
|
description="Enter a reference text and a candidate text to calculate the TeXBLEU score." |
|
) |
|
|
|
if __name__ == "__main__": |
|
demo.launch(share=True) |