changed app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,22 @@
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
from jiwer import wer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
|
6 |
def compute(input):
|
@@ -12,6 +28,8 @@ def compute(input):
|
|
12 |
return err
|
13 |
|
14 |
|
|
|
|
|
15 |
demo = gr.Interface(
|
16 |
fn=compute,
|
17 |
inputs=gr.components.Dataframe(
|
@@ -21,10 +39,9 @@ demo = gr.Interface(
|
|
21 |
label="Input"
|
22 |
),
|
23 |
outputs=gr.components.Textbox(label="WER"),
|
24 |
-
description=
|
25 |
-
"This is a calculator that you can use to find WER"
|
26 |
-
),
|
27 |
title="WER Calculator",
|
|
|
28 |
)
|
29 |
|
30 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
import pandas as pd
|
3 |
from jiwer import wer
|
4 |
+
import re
|
5 |
+
import os
|
6 |
+
|
7 |
+
REGEX_YAML_BLOCK = re.compile(r"---[\n\r]+([\S\s]*?)[\n\r]+---[\n\r]")
|
8 |
+
|
9 |
+
|
10 |
+
def parse_readme(filepath):
|
11 |
+
"""Parses a repositories README and removes"""
|
12 |
+
if not os.path.exists(filepath):
|
13 |
+
return "No README.md found."
|
14 |
+
with open(filepath, "r") as f:
|
15 |
+
text = f.read()
|
16 |
+
match = REGEX_YAML_BLOCK.search(text)
|
17 |
+
if match:
|
18 |
+
text = text[match.end() :]
|
19 |
+
return text
|
20 |
|
21 |
|
22 |
def compute(input):
|
|
|
28 |
return err
|
29 |
|
30 |
|
31 |
+
description = "This is a calculator that you can use to find WER"
|
32 |
+
|
33 |
demo = gr.Interface(
|
34 |
fn=compute,
|
35 |
inputs=gr.components.Dataframe(
|
|
|
39 |
label="Input"
|
40 |
),
|
41 |
outputs=gr.components.Textbox(label="WER"),
|
42 |
+
description=description,
|
|
|
|
|
43 |
title="WER Calculator",
|
44 |
+
article=parse_readme("README.md")
|
45 |
)
|
46 |
|
47 |
demo.launch()
|