gorkaartola commited on
Commit
0a9ff46
1 Parent(s): a955e6d

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -38
app.py CHANGED
@@ -1,40 +1,6 @@
1
- import gradio as gr
2
- import run
3
- import options as op
4
- import re
5
- import os
6
 
7
- REGEX_YAML_BLOCK = re.compile(r"---[\n\r]+([\S\s]*?)[\n\r]+---[\n\r]")
8
 
9
- def parse_readme(filepath):
10
- """Parses a repositories README and removes"""
11
- if not os.path.exists(filepath):
12
- return "No README.md found."
13
- with open(filepath, "r") as f:
14
- text = f.read()
15
- match = REGEX_YAML_BLOCK.search(text)
16
- if match:
17
- text = text[match.end() :]
18
- return text
19
-
20
- queries = []
21
- for query_dataset in op.queries.keys():
22
- for query_file in op.queries[query_dataset].keys():
23
- queries.append(query_dataset+'-'+query_file)
24
-
25
- iface = gr.Interface(
26
- run.tp_tf_test,
27
- [
28
- gr.Radio(list(op.metrics.keys())),
29
- gr.Radio(list(op.test_datasets.keys())),
30
- gr.Radio(list(op.models.keys())),
31
- gr.Radio(queries),
32
- gr.Radio(list(op.prompts.keys())),
33
- gr.CheckboxGroup(list(op.prediction_strategy_options.keys())),
34
- ],
35
- gr.File(),
36
- title="Zero Shot Classification Tester",
37
- article=parse_readme("README.md"),
38
- )
39
-
40
- iface.launch()
 
1
+ import evaluate
2
+ from evaluate.utils import launch_gradio_widget
 
 
 
3
 
 
4
 
5
+ module = evaluate.load("gorkaartola/metric_for_tp_fp_samples")
6
+ launch_gradio_widget(module)