faizhalas commited on
Commit
0d32192
·
verified ·
1 Parent(s): d920d55

Update pages/reader.py

Browse files
Files changed (1) hide show
  1. pages/reader.py +112 -105
pages/reader.py CHANGED
@@ -34,108 +34,115 @@ st.write(paramx)
34
 
35
  filtered_df = df[df['ID'] == paramx]
36
 
37
- with st.sidebar:
38
- st.write("Atur Tampilan")
39
-
40
- font_options = ["Baskerville", "Cambria", "Charter", "Garamond", "Georgia", "Palatino Linotype", "Times New Roman"]
41
- font_selected = st.selectbox("Gaya kata", font_options)
42
-
43
- fontsize = st.number_input("Ukuran kata", min_value=5, value=16, step=1)
44
- no_columns = st.number_input("Jumlah kolom", min_value=1, max_value=4, value=1, step=1)
45
-
46
- if not filtered_df.empty:
47
- filtered_df = filtered_df.replace("NaN", "Tidak tersedia")
48
- row = filtered_df.iloc[0]
49
-
50
- # Get and clean values
51
- title = format_html(row.get("Title", ""))
52
- author = format_html(row.get("Authors", ""))
53
- intro = format_html(row.get("Introduction", ""))
54
- method = format_html(row.get("Method", ""))
55
- abstracten = format_html(row.get("Abstract (en)", ""))
56
- abstractid = format_html(row.get("Abstract (id)", ""))
57
- keywords = format_html(row.get("Keywords", ""))
58
- affiliation = format_html(row.get("Institution", ""))
59
- result = format_html(row.get("Result", ""))
60
- discussion = format_html(row.get("Discussion", ""))
61
- rnd = format_html(row.get("Result & Discussion", ""))
62
- conclusion = format_html(row.get("Conclusion", ""))
63
-
64
- # CSS styles for individual sections (no container)
65
- html_output = f"""
66
- <style>
67
- .article-title {{
68
- text-align: center;
69
- font-size: 28px;
70
- font-weight: bold;
71
- font-family: {font_selected}, serif;
72
- color: #222;
73
- margin-bottom: 5px;
74
- }}
75
- .article-author {{
76
- text-align: center;
77
- font-size: 16px;
78
- color: #666;
79
- margin-bottom: 20px;
80
- font-style: italic;
81
- }}
82
- .section-title {{
83
- text-align: center;
84
- font-size: 20px;
85
- font-weight: bold;
86
- margin-top: 25px;
87
- margin-bottom: 10px;
88
- color: #004488;
89
- }}
90
- .section-meta {{
91
- text-align: center;
92
- font-size: {fontsize}px;
93
- font-family: {font_selected}, serif;
94
- line-height: 1.8;
95
- color: #333;
96
- font-style: italic;
97
- }}
98
- .section-content {{
99
- column-count: {no_columns};
100
- column-gap: 40px;
101
- text-align: justify;
102
- font-size: {fontsize}px;
103
- font-family: {font_selected}, serif;
104
- line-height: 1.8;
105
- color: #333;
106
- }}
107
- </style>
108
-
109
- <div class="article-title">{title}</div>
110
- <div class="article-author">By {author}</div>
111
- <div class="article-author">{affiliation}</div>
112
-
113
- <div class="section-title">Abstract</div>
114
- <div class="section-meta">{abstracten}</div>
115
- <div class="section-title">Abstrak</div>
116
- <div class="section-meta">{abstractid}</div>
117
- <div class="article-author">Keywords: {keywords}</div>
118
-
119
- <div class="section-title">Introduction</div>
120
- <div class="section-content">{intro}</div>
121
-
122
- <div class="section-title">Method</div>
123
- <div class="section-content">{method}</div>
124
-
125
- <div class="section-title">Result</div>
126
- <div class="section-content">{result}</div>
127
-
128
- <div class="section-title">Discussion</div>
129
- <div class="section-content">{discussion}</div>
130
-
131
- <div class="section-title">Result & Discussion</div>
132
- <div class="section-content">{rnd}</div>
133
-
134
- <div class="section-title">Conclusion</div>
135
- <div class="section-content">{conclusion}</div>
136
- """
137
-
138
- st.markdown(html_output, unsafe_allow_html=True)
139
-
140
- else:
141
- st.warning("No article found with the specified ID.")
 
 
 
 
 
 
 
 
34
 
35
  filtered_df = df[df['ID'] == paramx]
36
 
37
+ tab1, tab2 = st.tabs(["📄 Baca Artikel", "📊 Analisis Artikel"], width="stretch")
38
+
39
+ with tab1:
40
+
41
+ with st.sidebar:
42
+ st.write("Atur Tampilan")
43
+
44
+ font_options = ["Baskerville", "Cambria", "Charter", "Garamond", "Georgia", "Palatino Linotype", "Times New Roman"]
45
+ font_selected = st.selectbox("Gaya kata", font_options)
46
+
47
+ fontsize = st.number_input("Ukuran kata", min_value=5, value=16, step=1)
48
+ no_columns = st.number_input("Jumlah kolom", min_value=1, max_value=4, value=1, step=1)
49
+
50
+ if not filtered_df.empty:
51
+ filtered_df = filtered_df.replace("NaN", "Tidak tersedia")
52
+ row = filtered_df.iloc[0]
53
+
54
+ # Get and clean values
55
+ title = format_html(row.get("Title", ""))
56
+ author = format_html(row.get("Authors", ""))
57
+ intro = format_html(row.get("Introduction", ""))
58
+ method = format_html(row.get("Method", ""))
59
+ abstracten = format_html(row.get("Abstract (en)", ""))
60
+ abstractid = format_html(row.get("Abstract (id)", ""))
61
+ keywords = format_html(row.get("Keywords", ""))
62
+ affiliation = format_html(row.get("Institution", ""))
63
+ result = format_html(row.get("Result", ""))
64
+ discussion = format_html(row.get("Discussion", ""))
65
+ rnd = format_html(row.get("Result & Discussion", ""))
66
+ conclusion = format_html(row.get("Conclusion", ""))
67
+
68
+ # CSS styles for individual sections (no container)
69
+ html_output = f"""
70
+ <style>
71
+ .article-title {{
72
+ text-align: center;
73
+ font-size: 28px;
74
+ font-weight: bold;
75
+ font-family: {font_selected}, serif;
76
+ color: #222;
77
+ margin-bottom: 5px;
78
+ }}
79
+ .article-author {{
80
+ text-align: center;
81
+ font-size: 16px;
82
+ color: #666;
83
+ margin-bottom: 20px;
84
+ font-style: italic;
85
+ }}
86
+ .section-title {{
87
+ text-align: center;
88
+ font-size: 20px;
89
+ font-weight: bold;
90
+ margin-top: 25px;
91
+ margin-bottom: 10px;
92
+ color: #004488;
93
+ }}
94
+ .section-meta {{
95
+ text-align: center;
96
+ font-size: {fontsize}px;
97
+ font-family: {font_selected}, serif;
98
+ line-height: 1.8;
99
+ color: #333;
100
+ font-style: italic;
101
+ }}
102
+ .section-content {{
103
+ column-count: {no_columns};
104
+ column-gap: 40px;
105
+ text-align: justify;
106
+ font-size: {fontsize}px;
107
+ font-family: {font_selected}, serif;
108
+ line-height: 1.8;
109
+ color: #333;
110
+ }}
111
+ </style>
112
+
113
+ <div class="article-title">{title}</div>
114
+ <div class="article-author">By {author}</div>
115
+ <div class="article-author">{affiliation}</div>
116
+
117
+ <div class="section-title">Abstract</div>
118
+ <div class="section-meta">{abstracten}</div>
119
+ <div class="section-title">Abstrak</div>
120
+ <div class="section-meta">{abstractid}</div>
121
+ <div class="article-author">Keywords: {keywords}</div>
122
+
123
+ <div class="section-title">Introduction</div>
124
+ <div class="section-content">{intro}</div>
125
+
126
+ <div class="section-title">Method</div>
127
+ <div class="section-content">{method}</div>
128
+
129
+ <div class="section-title">Result</div>
130
+ <div class="section-content">{result}</div>
131
+
132
+ <div class="section-title">Discussion</div>
133
+ <div class="section-content">{discussion}</div>
134
+
135
+ <div class="section-title">Result & Discussion</div>
136
+ <div class="section-content">{rnd}</div>
137
+
138
+ <div class="section-title">Conclusion</div>
139
+ <div class="section-content">{conclusion}</div>
140
+ """
141
+
142
+ st.markdown(html_output, unsafe_allow_html=True)
143
+
144
+ else:
145
+ st.warning("No article found with the specified ID.")
146
+
147
+ with tab2:
148
+ st.write("Dalam pembangunan")