import gradio as gr import subprocess import sys # Clone the repository repo_url = "https://github.com/KyuDan1/TeXBLEU.git" repo_name = "TeXBLEU" subprocess.run(["git", "clone", repo_url]) # Add the cloned repository to Python path sys.path.append(repo_name) # Import the texbleu function from new_metric import texbleu def calculate_texbleu(reference, candidate): # Calculate TeXBLEU score result = texbleu(reference, candidate) return f"TeXBLEU Score: {result}" # Gradio interface setup 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)