Spaces:
Running
Running
initial commit to verify that gradio works on HF
Browse files- app.py +94 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import pandas as pd
|
3 |
+
import random
|
4 |
+
import plotly.express as px
|
5 |
+
|
6 |
+
|
7 |
+
def greet(name):
|
8 |
+
return "Hello " + name + "!"
|
9 |
+
|
10 |
+
|
11 |
+
def get_results_df():
|
12 |
+
data = {
|
13 |
+
"Model": ["Model A", "Model B", "Model C"],
|
14 |
+
"Avg": [0.85, 0.90, 0.88],
|
15 |
+
"Gap Read": [0.05, 0.03, 0.04],
|
16 |
+
"Gap Spontaneous": [0.07, 0.06, 0.05],
|
17 |
+
}
|
18 |
+
|
19 |
+
df = pd.DataFrame(data)
|
20 |
+
return df
|
21 |
+
|
22 |
+
|
23 |
+
def get_language_performance():
|
24 |
+
languages = [
|
25 |
+
"en",
|
26 |
+
"es",
|
27 |
+
"de",
|
28 |
+
"fr",
|
29 |
+
"it",
|
30 |
+
"pt",
|
31 |
+
"nl",
|
32 |
+
"ru",
|
33 |
+
"zh",
|
34 |
+
"ja",
|
35 |
+
"ko",
|
36 |
+
"ar",
|
37 |
+
"hi",
|
38 |
+
"bn",
|
39 |
+
"ur",
|
40 |
+
"tr",
|
41 |
+
"sv",
|
42 |
+
]
|
43 |
+
data = {
|
44 |
+
"Model": ["Model A", "Model B", "Model C"],
|
45 |
+
}
|
46 |
+
|
47 |
+
for lang in languages:
|
48 |
+
data[lang] = [random.uniform(-100, 100) for _ in range(3)]
|
49 |
+
|
50 |
+
df = pd.DataFrame(data)
|
51 |
+
return df
|
52 |
+
|
53 |
+
|
54 |
+
results = get_results_df()
|
55 |
+
|
56 |
+
with gr.Blocks() as fm_interface:
|
57 |
+
gr.DataFrame(results)
|
58 |
+
|
59 |
+
language_performance = get_language_performance()
|
60 |
+
print(language_performance)
|
61 |
+
|
62 |
+
fig1 = px.bar(
|
63 |
+
language_performance.melt(
|
64 |
+
id_vars="Model", var_name="Language", value_name="Performance"
|
65 |
+
),
|
66 |
+
x="Language",
|
67 |
+
y="Performance",
|
68 |
+
color="Model",
|
69 |
+
title="Language Performance Plot 1",
|
70 |
+
barmode="group",
|
71 |
+
)
|
72 |
+
fig2 = px.bar(
|
73 |
+
language_performance.melt(
|
74 |
+
id_vars="Model", var_name="Language", value_name="Performance"
|
75 |
+
),
|
76 |
+
x="Language",
|
77 |
+
y="Performance",
|
78 |
+
color="Model",
|
79 |
+
title="Language Performance Plot 2",
|
80 |
+
barmode="group",
|
81 |
+
)
|
82 |
+
|
83 |
+
gr.Plot(fig1)
|
84 |
+
gr.Plot(fig2)
|
85 |
+
|
86 |
+
tabs = [fm_interface]
|
87 |
+
titles = ["F-M Setup"]
|
88 |
+
|
89 |
+
with gr.Blocks() as demo:
|
90 |
+
gr.Markdown("# Fair ASR Leadeboard")
|
91 |
+
gr.TabbedInterface(tabs, titles)
|
92 |
+
|
93 |
+
if __name__ == "__main__":
|
94 |
+
demo.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
gradio
|
2 |
+
plotly
|