Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -17,21 +17,19 @@ def show_extra_info(e):
|
|
17 |
try:
|
18 |
data_v = json.loads(e["dataset_versions"])[0]
|
19 |
except:
|
20 |
-
|
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"
|
28 |
else:
|
29 |
data_text = ""
|
30 |
|
31 |
-
text = f"The title of the notebook is: **'{
|
32 |
return text
|
33 |
|
34 |
samples = load_data()
|
35 |
-
index_example = st.number_input(f"
|
36 |
st.markdown(show_extra_info(samples[index_example]))
|
37 |
st.code(samples[index_example]["script"])
|
|
|
17 |
try:
|
18 |
data_v = json.loads(e["dataset_versions"])[0]
|
19 |
except:
|
20 |
+
data_v = ""
|
|
|
|
|
21 |
if data_v:
|
22 |
data_title = data_v["Title"]
|
23 |
import numpy as np
|
24 |
decription = data_v["Description"] if str(data_v["Description"]) != 'nan' else "<empty_description>"
|
25 |
+
data_text = f"**Dataset description**\nTitle: '{data_title}', described as: {decription}"
|
26 |
else:
|
27 |
data_text = ""
|
28 |
|
29 |
+
text = f"The title of the notebook is: **'{kv["Title"]}'** and it has **{kv["TotalVotes"]} upvotes**.\n{data_text}"
|
30 |
return text
|
31 |
|
32 |
samples = load_data()
|
33 |
+
index_example = st.number_input(f"Chose a sample from the existing {len(samples)} notebooks:", min_value=0, max_value=len(samples)-1, value=0, step=1)
|
34 |
st.markdown(show_extra_info(samples[index_example]))
|
35 |
st.code(samples[index_example]["script"])
|