lvwerra HF staff commited on
Commit
98c3786
1 Parent(s): 8361eb8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -70,10 +70,15 @@ if max_docs > 0:
70
  example = samples[index_example]
71
 
72
  st.markdown("#### File content:")
 
 
 
 
 
73
  if example["lexable"]:
74
- st.code(example["content"], language=chosen_language)
75
  else:
76
  st.text(f"File can't be lexed so we remove syntax highlighting.\nContent:\n")
77
- st.text(str(example["content"]))
78
  else:
79
  st.text("The dataset is empty after the filtering!")
 
70
  example = samples[index_example]
71
 
72
  st.markdown("#### File content:")
73
+ content = str(example["content"])
74
+
75
+ if len(content)>10_000:
76
+ content = example["content"][:10_000] + "\n[MORE CODE, DISPLAYING FIRST 10k CHARACTERS]"
77
+
78
  if example["lexable"]:
79
+ st.code(content, language=chosen_language)
80
  else:
81
  st.text(f"File can't be lexed so we remove syntax highlighting.\nContent:\n")
82
+ st.text(str(content))
83
  else:
84
  st.text("The dataset is empty after the filtering!")