MK-316 commited on
Commit
bffee5c
β€’
1 Parent(s): 6d9789e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -25,16 +25,24 @@ def search_years(search_by_year, search_by_keywords, query):
25
 
26
 
27
  # Modified function to return keywords above the HTML image tag
 
 
28
  def get_image_html(year):
29
  match = df[df['YEAR'] == year]
30
  if not match.empty:
31
- image_url = match.iloc[0]['LINK']
 
 
 
32
  keywords = match.iloc[0]['KEYWORDS']
33
  # Place keywords above the image
34
  return f"<b>🌷 Keywords:</b> πŸ”‘ {keywords}<br><img src='{image_url}' width='800'/>"
35
  else:
36
  return "No keywords found for this year.", "No image found for this year."
37
 
 
 
 
38
  # Create Gradio Blocks interface
39
  with gr.Blocks() as app:
40
  gr.Markdown("# Teacher Certificate Exam Searching Engine")
 
25
 
26
 
27
  # Modified function to return keywords above the HTML image tag
28
+ # ...
29
+
30
  def get_image_html(year):
31
  match = df[df['YEAR'] == year]
32
  if not match.empty:
33
+ # Assuming 'LINK' column has the partial path like '2006_1.PNG'
34
+ image_filename = match.iloc[0]['LINK']
35
+ # Construct the full URL by appending the filename to the base path
36
+ image_url = f'https://huggingface.co/spaces/MK-316/TCE/blob/main/TExams/{image_filename}'
37
  keywords = match.iloc[0]['KEYWORDS']
38
  # Place keywords above the image
39
  return f"<b>🌷 Keywords:</b> πŸ”‘ {keywords}<br><img src='{image_url}' width='800'/>"
40
  else:
41
  return "No keywords found for this year.", "No image found for this year."
42
 
43
+ # ...
44
+
45
+
46
  # Create Gradio Blocks interface
47
  with gr.Blocks() as app:
48
  gr.Markdown("# Teacher Certificate Exam Searching Engine")