Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,12 +9,29 @@ st.markdown("<h1 style='text-align: center; color: #00BFFF;'>Kaggle Notebooks in
|
|
9 |
st.markdown("Here you can inspect Kaggle notebooks that were converted to python scripts and deduplicated.")
|
10 |
@st.cache()
|
11 |
def load_data():
|
12 |
-
ds = load_dataset("loubnabnl/
|
13 |
return ds
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
samples = load_data()
|
16 |
-
#col1, _ = st.columns([2, 4])
|
17 |
-
#with col1:
|
18 |
index_example = st.number_input(f"Index of the chosen sample from the existing {len(samples)}", min_value=0, max_value=len(samples)-1, value=0, step=1)
|
19 |
-
|
20 |
st.code(samples[index_example]["script"])
|
|
|
9 |
st.markdown("Here you can inspect Kaggle notebooks that were converted to python scripts and deduplicated.")
|
10 |
@st.cache()
|
11 |
def load_data():
|
12 |
+
ds = load_dataset("loubnabnl/subset_kaggle_scripts", split="train")
|
13 |
return ds
|
14 |
|
15 |
+
def show_extra_info(e):
|
16 |
+
kv = json.loads(e["kversion"])[0]
|
17 |
+
try:
|
18 |
+
data_v = json.loads(e["dataset_versions"])[0]
|
19 |
+
except:
|
20 |
+
datav = ""
|
21 |
+
nb_title = kv["Title"]
|
22 |
+
nb_votes = kv["TotalVotes"]
|
23 |
+
if data_v:
|
24 |
+
data_title = data_v["Title"]
|
25 |
+
import numpy as np
|
26 |
+
decription = data_v["Description"] if str(data_v["Description"]) != 'nan' else "<empty_description>"
|
27 |
+
data_text = f"It uses dataset: '{data_title}', described as: {decription}"
|
28 |
+
else:
|
29 |
+
data_text = ""
|
30 |
+
|
31 |
+
text = f"The title of the notebook is: '{nb_title}' and it has {nb_votes} upvotes. {data_text}"
|
32 |
+
return text
|
33 |
+
|
34 |
samples = load_data()
|
|
|
|
|
35 |
index_example = st.number_input(f"Index of the chosen sample from the existing {len(samples)}", min_value=0, max_value=len(samples)-1, value=0, step=1)
|
36 |
+
st.markdown(show_extra_info(samples[index_example]))
|
37 |
st.code(samples[index_example]["script"])
|