File size: 1,070 Bytes
997f044
 
 
 
 
90f9b75
997f044
a3ecf62
997f044
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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()