annikwag commited on
Commit
5616c02
·
verified ·
1 Parent(s): aae060b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -47,6 +47,7 @@ _, unique_sub_regions = get_regions(region_df)
47
  def get_country_name_and_region_mapping(_client, collection_name, region_df):
48
  results = hybrid_search(_client, "", collection_name)
49
  country_set = set()
 
50
  for res in results[0] + results[1]:
51
  countries = res.payload.get('metadata', {}).get('countries', "[]")
52
  try:
@@ -216,7 +217,7 @@ if show_exact_matches:
216
  # Snippet logic (80 words)
217
  full_text = res.payload['page_content']
218
  words = full_text.split()
219
- preview_word_count = 80
220
  preview_text = " ".join(words[:preview_word_count])
221
  remainder_text = " ".join(words[preview_word_count:])
222
  st.write(preview_text + ("..." if remainder_text else ""))
@@ -255,18 +256,16 @@ if show_exact_matches:
255
  start_year_str = f"{int(round(float(start_year)))}" if start_year else "Unknown"
256
  end_year_str = f"{int(round(float(end_year)))}" if end_year else "Unknown"
257
 
258
- # Build the final string
259
  if matched_countries:
260
- # We have at least 1 valid country name
261
  additional_text = (
262
  f"**{', '.join(matched_countries)}**, commissioned by **{client_name}**, "
263
- f"**{start_year_str}-{end_year_str}**"
264
  )
265
  else:
266
- # No valid countries found
267
  additional_text = (
268
- f"Commissioned by **{client_name}**, **{start_year_str}-{end_year_str}**"
269
  )
 
270
 
271
  st.markdown(additional_text)
272
  st.divider()
@@ -327,16 +326,15 @@ else:
327
 
328
  # Build the final string
329
  if matched_countries:
330
- # We have at least 1 valid country name
331
  additional_text = (
332
  f"**{', '.join(matched_countries)}**, commissioned by **{client_name}**, "
333
- f"**{start_year_str}-{end_year_str}**"
334
  )
335
  else:
336
- # No valid countries found
337
  additional_text = (
338
- f"Commissioned by **{client_name}**, **{start_year_str}-{end_year_str}**"
339
  )
 
340
 
341
  st.markdown(additional_text)
342
  st.divider()
 
47
  def get_country_name_and_region_mapping(_client, collection_name, region_df):
48
  results = hybrid_search(_client, "", collection_name)
49
  country_set = set()
50
+
51
  for res in results[0] + results[1]:
52
  countries = res.payload.get('metadata', {}).get('countries', "[]")
53
  try:
 
217
  # Snippet logic (80 words)
218
  full_text = res.payload['page_content']
219
  words = full_text.split()
220
+ preview_word_count = 200
221
  preview_text = " ".join(words[:preview_word_count])
222
  remainder_text = " ".join(words[preview_word_count:])
223
  st.write(preview_text + ("..." if remainder_text else ""))
 
256
  start_year_str = f"{int(round(float(start_year)))}" if start_year else "Unknown"
257
  end_year_str = f"{int(round(float(end_year)))}" if end_year else "Unknown"
258
 
 
259
  if matched_countries:
 
260
  additional_text = (
261
  f"**{', '.join(matched_countries)}**, commissioned by **{client_name}**, "
262
+ f"**{start_year_str}-{end_year_str}**, project ID: {start_year_str}, project budget: {total_project}"
263
  )
264
  else:
 
265
  additional_text = (
266
+ f"Commissioned by **{client_name}**, **{start_year_str}-{end_year_str}**, project ID: {start_year_str}, project budget: {total_project}"
267
  )
268
+
269
 
270
  st.markdown(additional_text)
271
  st.divider()
 
326
 
327
  # Build the final string
328
  if matched_countries:
 
329
  additional_text = (
330
  f"**{', '.join(matched_countries)}**, commissioned by **{client_name}**, "
331
+ f"**{start_year_str}-{end_year_str}**, project ID: {start_year_str}, project budget: {total_project}"
332
  )
333
  else:
 
334
  additional_text = (
335
+ f"Commissioned by **{client_name}**, **{start_year_str}-{end_year_str}**, project ID: {start_year_str}, project budget: {total_project}"
336
  )
337
+
338
 
339
  st.markdown(additional_text)
340
  st.divider()