# filename: gradioapp1.py import gradio as gr from ham import calculate_hierarchical_precision_recall from isco import create_hierarchy_dict # from tests import test_cases isco_csv_url = ( "https://www.ilo.org/ilostat-files/ISCO/newdocs-08-2021/ISCO-08/ISCO-08%20EN.csv" ) hierachy = create_hierarchy_dict(isco_csv_url) # Define the Gradio interface iface = gr.Interface( fn=calculate_hierarchical_precision_recall, inputs=[ gr.Textbox(lines=2, placeholder="Enter true labels separated by commas"), gr.Textbox(lines=2, placeholder="Enter predicted labels separated by commas"), gr.Textbox(lines=5, placeholder="Enter hierarchy in JSON format"), ], outputs="textbox", examples=[ # Add example inputs here if necessary ], description="This app calculates hierarchical precision and recall. Enter the true labels, predicted labels, and the hierarchy in JSON format.", ) # Run the app iface.launch()