faizhalas commited on
Commit
1ddfa45
·
verified ·
1 Parent(s): 61de47f

Update pages/reader.py

Browse files
Files changed (1) hide show
  1. pages/reader.py +55 -5
pages/reader.py CHANGED
@@ -32,9 +32,59 @@ st.write(paramx)
32
  filtered_df = df[df['ID'] == paramx]
33
 
34
  if not filtered_df.empty:
35
- st.write("### Article Info")
36
- st.write("**Title:**", filtered_df.iloc[0]['Title'])
37
- st.write("**Introduction:**", filtered_df.iloc[0]['Introduction'])
38
- st.write("**Method:**", filtered_df.iloc[0]['Method'])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  else:
40
- st.warning("No article found with that ID.")
 
32
  filtered_df = df[df['ID'] == paramx]
33
 
34
  if not filtered_df.empty:
35
+ row = filtered_df.iloc[0]
36
+
37
+ title = row["Title"]
38
+ author = row.get("Author", "Unknown Author")
39
+ intro = row["Introduction"]
40
+ method = row["Method"]
41
+
42
+ html_content = f"""
43
+ <style>
44
+ .article-container {{
45
+ font-family: 'Georgia', serif;
46
+ font-size: 16px;
47
+ line-height: 1.8;
48
+ color: #333;
49
+ padding: 20px;
50
+ background-color: #fefefe;
51
+ border-radius: 10px;
52
+ box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
53
+ }}
54
+ .article-title {{
55
+ font-size: 28px;
56
+ font-weight: bold;
57
+ margin-bottom: 5px;
58
+ }}
59
+ .article-author {{
60
+ font-size: 16px;
61
+ color: #666;
62
+ margin-bottom: 20px;
63
+ }}
64
+ .section-title {{
65
+ font-size: 20px;
66
+ font-weight: bold;
67
+ margin-top: 25px;
68
+ margin-bottom: 10px;
69
+ color: #004488;
70
+ }}
71
+ .section-content {{
72
+ text-align: justify;
73
+ }}
74
+ </style>
75
+
76
+ <div class="article-container">
77
+ <div class="article-title">{title}</div>
78
+ <div class="article-author">By {author}</div>
79
+
80
+ <div class="section-title">Introduction</div>
81
+ <div class="section-content">{intro}</div>
82
+
83
+ <div class="section-title">Method</div>
84
+ <div class="section-content">{method}</div>
85
+ </div>
86
+ """
87
+
88
+ st.markdown(html_content, unsafe_allow_html=True)
89
  else:
90
+ st.warning("No matching article found.")