annikwag commited on
Commit
8ad1360
·
verified ·
1 Parent(s): ff11e76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -3
app.py CHANGED
@@ -122,8 +122,17 @@ if button:
122
  project_name = res.payload['metadata'].get('project_name', 'Project Link')
123
  url = res.payload['metadata'].get('url', '#')
124
  st.markdown(f"#### [{project_name}]({url})")
125
- st.write(res.payload['page_content'])
126
- # Additional text below the content
 
 
 
 
 
 
 
 
 
127
  metadata = res.payload.get('metadata', {})
128
  countries = metadata.get('countries', "[]")
129
  client = metadata.get('client', 'Unknown Client')
@@ -157,7 +166,17 @@ if button:
157
  project_name = res.payload['metadata'].get('project_name', 'Project Link')
158
  url = res.payload['metadata'].get('url', '#')
159
  st.markdown(f"#### [{project_name}]({url})")
160
- st.write(res.payload['page_content'])
 
 
 
 
 
 
 
 
 
 
161
  # Additional text below the content
162
  metadata = res.payload.get('metadata', {})
163
  countries = metadata.get('countries', "[]")
 
122
  project_name = res.payload['metadata'].get('project_name', 'Project Link')
123
  url = res.payload['metadata'].get('url', '#')
124
  st.markdown(f"#### [{project_name}]({url})")
125
+ # ------- Display first 4 lines + expander -------
126
+ full_text = res.payload['page_content']
127
+ lines = full_text.split('\n')
128
+ short_text = '\n'.join(lines[:4])
129
+ st.write(short_text)
130
+
131
+ if len(lines) > 4:
132
+ with st.expander("Read more"):
133
+ st.write('\n'.join(lines[4:]))
134
+
135
+ # ------- Additional info below the text -------
136
  metadata = res.payload.get('metadata', {})
137
  countries = metadata.get('countries', "[]")
138
  client = metadata.get('client', 'Unknown Client')
 
166
  project_name = res.payload['metadata'].get('project_name', 'Project Link')
167
  url = res.payload['metadata'].get('url', '#')
168
  st.markdown(f"#### [{project_name}]({url})")
169
+ # ------- Display first 4 lines + expander -------
170
+ full_text = res.payload['page_content']
171
+ lines = full_text.split('\n')
172
+ short_text = '\n'.join(lines[:4])
173
+ st.write(short_text)
174
+
175
+ if len(lines) > 4:
176
+ with st.expander("Read more"):
177
+ st.write('\n'.join(lines[4:]))
178
+
179
+ # ------- Additional info below the text -------
180
  # Additional text below the content
181
  metadata = res.payload.get('metadata', {})
182
  countries = metadata.get('countries', "[]")