ppsingh commited on
Commit
8e5f4a1
1 Parent(s): dc219ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -29
app.py CHANGED
@@ -107,36 +107,22 @@ def make_html_source(source,i):
107
  # content = source.page_content.split(":",1)[1].strip()
108
  content = source.page_content.strip()
109
 
110
- toc_levels = []
111
- for j in range(2):
112
- level = meta[f"toc_level{j}"]
113
- if level != "N/A":
114
- toc_levels.append(level)
115
- else:
116
- break
117
- toc_levels = " > ".join(toc_levels)
118
-
119
- if len(toc_levels) > 0:
120
- name = f"<b>{toc_levels}</b><br/>{meta['name']}"
121
- else:
122
- name = meta['name']
123
-
124
- if meta["chunk_type"] == "text":
125
-
126
- card = f"""
127
- <div class="card" id="doc{i}">
128
- <div class="card-content">
129
- <h2>Doc {i} - {meta['short_name']} - Page {int(meta['page_number'])}</h2>
130
- <p>{content}</p>
131
  </div>
132
- <div class="card-footer">
133
- <span>{name}</span>
134
- <a href="{meta['url']}#page={int(meta['page_number'])}" target="_blank" class="pdf-link">
135
- <span role="img" aria-label="Open PDF">🔗</span>
136
- </a>
137
- </div>
138
- </div>
139
- """
140
  return card
141
  # --------------------------------------------------------------------
142
  # Gradio
 
107
  # content = source.page_content.split(":",1)[1].strip()
108
  content = source.page_content.strip()
109
 
110
+ name = meta['source']
111
+ card = f"""
112
+ <div class="card" id="doc{i}">
113
+ <div class="card-content">
114
+ <h2>Doc {i} - {meta['file_path']} - Page {int(meta['page'])}</h2>
115
+ <p>{content}</p>
116
+ </div>
117
+ <div class="card-footer">
118
+ <span>{name}</span>
119
+ <a href="{meta['file_path']}#page={int(meta['page'])}" target="_blank" class="pdf-link">
120
+ <span role="img" aria-label="Open PDF">🔗</span>
121
+ </a>
122
+ </div>
 
 
 
 
 
 
 
 
123
  </div>
124
+ """
125
+
 
 
 
 
 
 
126
  return card
127
  # --------------------------------------------------------------------
128
  # Gradio