File size: 1,031 Bytes
90f9b75
 
 
a3ecf62
bfdfdc9
90f9b75
a3ecf62
 
 
 
 
 
 
 
 
 
 
 
90f9b75
c08723b
 
 
 
 
90f9b75
 
 
da6fb8e
67069f4
da6fb8e
c08723b
90f9b75
 
 
 
67069f4
9f8d320
90f9b75
 
 
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.metrics.keys())),
		gr.Radio(list(op.test_datasets.keys())),
		gr.Radio(list(op.models.keys())),		
		gr.Radio(queries),
		gr.Radio(list(op.prompts.keys())),
		gr.CheckboxGroup(list(op.prediction_strategy_options.keys())),
	],
	gr.File(),
	title="Zero Shot Classification Tester",
	article=parse_readme("README.md"),
    	)

iface.launch()