jvamvas commited on
Commit
dcfa759
·
1 Parent(s): 8fe63db

Display readme in app

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py CHANGED
@@ -11,6 +11,31 @@ from lemmatizer import Lemmatizer
11
  csv.field_size_limit(csv.field_size_limit(2**31 - 1) )
12
 
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  if gr.NO_RELOAD:
15
  lemmatizer = Lemmatizer(leanred_et=False)
16
 
@@ -225,6 +250,9 @@ with gr.Blocks(
225
  "<sup style='color:#FF5252;font-size:0.4em;vertical-align:super'>(BETA)</sup>"
226
  )
227
 
 
 
 
228
  # === Top Row: Input & Chart ===
229
  with gr.Row():
230
  with gr.Column(scale=1):
 
11
  csv.field_size_limit(csv.field_size_limit(2**31 - 1) )
12
 
13
 
14
+ def load_readme():
15
+ """Load README.md content and strip YAML frontmatter."""
16
+ readme_path = os.path.join(os.path.dirname(__file__), "README.md")
17
+ with open(readme_path, "r", encoding="utf-8") as file:
18
+ content = file.read()
19
+
20
+ # Strip YAML frontmatter (content between --- markers)
21
+ if content.startswith("---"):
22
+ # Find the second occurrence of ---
23
+ lines = content.split("\n")
24
+ frontmatter_end = None
25
+ for index, line in enumerate(lines[1:], start=1):
26
+ if line.strip() == "---":
27
+ frontmatter_end = index
28
+ break
29
+
30
+ if frontmatter_end is not None:
31
+ # Return content after frontmatter, skipping the blank line if present
32
+ content = "\n".join(lines[frontmatter_end + 1:]).lstrip("\n")
33
+
34
+ return content
35
+
36
+
37
+ readme_content = load_readme()
38
+
39
  if gr.NO_RELOAD:
40
  lemmatizer = Lemmatizer(leanred_et=False)
41
 
 
250
  "<sup style='color:#FF5252;font-size:0.4em;vertical-align:super'>(BETA)</sup>"
251
  )
252
 
253
+ with gr.Accordion("About", open=False):
254
+ gr.Markdown(readme_content)
255
+
256
  # === Top Row: Input & Chart ===
257
  with gr.Row():
258
  with gr.Column(scale=1):