gorkaartola's picture
Update app.py
bfdfdc9
raw
history blame
900 Bytes
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
iface = gr.Interface(
run.tp_tf_test,
[
gr.Radio(list(op.models.keys())),
gr.Radio(list(op.test_datasets.keys())),
gr.Radio(list(op.queries.keys())),
gr.Radio(list(op.prompts.keys())),
gr.Radio(list(op.metrics.keys())),
gr.CheckboxGroup(list(op.prediction_strategy_options.keys())),
],
gr.File(),
title="Testing Zero Shot Classification by SDGs",
article=parse_readme("README.md"),
)
iface.launch()