Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import run | |
| import options as op | |
| import re | |
| import os | |
| REGEX_YAML_BLOCK = re.compile(r"---[\n\r]+([\S\s]*?)[\n\r]+---[\n\r]") | |
| def parse_readme(filepath): | |
| """Parses a repositories README and removes""" | |
| if not os.path.exists(filepath): | |
| return "No README.md found." | |
| with open(filepath, "r") as f: | |
| text = f.read() | |
| match = REGEX_YAML_BLOCK.search(text) | |
| if match: | |
| text = text[match.end() :] | |
| return text | |
| queries = [] | |
| for query_dataset in op.queries.keys(): | |
| for query_file in op.queries[query_dataset].keys(): | |
| queries.append(query_dataset+'-'+query_file) | |
| iface = gr.Interface( | |
| run.tp_tf_test, | |
| [ | |
| gr.Radio(list(op.models.keys())), | |
| gr.Radio(list(op.test_datasets.keys())), | |
| gr.Radio(queries), | |
| gr.Radio(list(op.prompts.keys())), | |
| gr.Radio(list(op.metrics.keys())), | |
| gr.CheckboxGroup(list(op.prediction_strategy_options.keys())), | |
| ], | |
| gr.File(), | |
| title="Zero Shot Classifier Tester for True Positive and False Positive Samples", | |
| article=parse_readme("README.md"), | |
| ) | |
| iface.launch() | |