Spaces:
Runtime error
Runtime error
Update results.py
Browse files- results.py +28 -17
results.py
CHANGED
|
@@ -1,25 +1,35 @@
|
|
| 1 |
from fasthtml.common import *
|
| 2 |
from fasthtml.components import *
|
| 3 |
import json
|
| 4 |
-
from
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
|
| 8 |
-
with open("data/graph_data.jsonl", "r") as f:
|
| 9 |
-
#if title == "Perplexity Across Different Buckets (global)":
|
| 10 |
-
for line in f:
|
| 11 |
-
for title, meta in json.loads(line).items():
|
| 12 |
-
_, ax = pyplot.subplots()
|
| 13 |
-
for i, (label, data, color) in enumerate(meta["data"]):
|
| 14 |
-
ax.plot(*data, label=label, color=color)
|
| 15 |
|
| 16 |
-
ax.grid()
|
| 17 |
-
ax.set_xlabel(meta["x_label"])
|
| 18 |
-
ax.set_ylabel(meta["y_label"])
|
| 19 |
-
ax.set_title(title)
|
| 20 |
-
ax.legend()
|
| 21 |
-
|
| 22 |
-
fig = pyplot.show()
|
| 23 |
|
| 24 |
intro_div = Div(
|
| 25 |
H2("Perplexity Evaluation on Duplicate Data"),
|
|
@@ -98,7 +108,8 @@ def results():
|
|
| 98 |
intro_div,
|
| 99 |
perp1_div,
|
| 100 |
llama_div,
|
| 101 |
-
|
|
|
|
| 102 |
id="inner-text"
|
| 103 |
)
|
| 104 |
)
|
|
|
|
| 1 |
from fasthtml.common import *
|
| 2 |
from fasthtml.components import *
|
| 3 |
import json
|
| 4 |
+
from fh_plotly import plotly2fasthtml
|
| 5 |
+
import pandas as pd
|
| 6 |
+
import plotly.express as px
|
| 7 |
+
|
| 8 |
+
#Perplexity Across Different Buckets (global)
|
| 9 |
+
DATA = {
|
| 10 |
+
"2014": "1-1": 17.410227605477868,
|
| 11 |
+
"2014": "2-5": 16.11176217183986,
|
| 12 |
+
"2014": "6-10": 15.632757662414805,
|
| 13 |
+
"2014": "11-100": 15.446116676532212,
|
| 14 |
+
"2014": "101-1000": 16.716943171826703,
|
| 15 |
+
"2014": "1001-30000000": 18.156821563322765,
|
| 16 |
+
}
|
| 17 |
+
Perplexity_Across_Different_Buckets_global = pd.DataFrame(
|
| 18 |
+
DATA, columns=["Year", "Bucket", "Perplexity"]
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
fig = px.line(
|
| 22 |
+
Perplexity_Across_Different_Buckets_global,
|
| 23 |
+
x="Bucket",
|
| 24 |
+
y="Perplexity",
|
| 25 |
+
labels={"Bucket": "Bucket", "Perplexity": "Perplexity"},
|
| 26 |
+
)
|
| 27 |
+
|
| 28 |
+
Perplexity_Across_Different_Buckets_global_graph = fig
|
| 29 |
+
|
| 30 |
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
intro_div = Div(
|
| 35 |
H2("Perplexity Evaluation on Duplicate Data"),
|
|
|
|
| 108 |
intro_div,
|
| 109 |
perp1_div,
|
| 110 |
llama_div,
|
| 111 |
+
P("test plotly"),
|
| 112 |
+
plotly2fasthtml(Perplexity_Across_Different_Buckets_global_graph),
|
| 113 |
id="inner-text"
|
| 114 |
)
|
| 115 |
)
|