rwillats commited on
Commit
fecb216
·
verified ·
1 Parent(s): 43178f3

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. hate_speech_demo.py +25 -7
hate_speech_demo.py CHANGED
@@ -36,6 +36,7 @@ function openPolicyPopup() {{
36
  </script>
37
  """
38
 
 
39
  def process_retrieval_text(retrieval_text, user_input):
40
  """
41
  Process the retrieval text by identifying proper document boundaries
@@ -69,11 +70,15 @@ def process_retrieval_text(retrieval_text, user_input):
69
  # Format with clear section headers and better spacing
70
  formatted_html = f"""
71
  <div class='doc-section'>
72
- <h3 class="doc-number">Evidence Document {i+1}</h3>
73
- <div class="doc-info">
74
- <p><strong>Document Title:</strong> {doc_name}</p>
75
- <p><strong>Section:</strong> Page {page}</p>
 
 
 
76
  </div>
 
77
  <div class="doc-content-container">
78
  <h4>Content:</h4>
79
  <div class='doc-content'>{content}</div>
@@ -110,7 +115,7 @@ def process_retrieval_text(retrieval_text, user_input):
110
  # Format each chunk with better section styling
111
  chunks = [f"""
112
  <div class='doc-section'>
113
- <h3 class="doc-title">Evidence Document {i+1}</h3>
114
  <div class='doc-content'>{chunk.strip()}</div>
115
  </div>
116
  """ for i, chunk in enumerate(chunks)]
@@ -158,15 +163,28 @@ def process_retrieval_text(retrieval_text, user_input):
158
  font-size: 18px;
159
  }
160
 
161
- .doc-info {
162
  margin: 10px 0;
163
  padding: 8px;
164
  background: #f5f5f5;
165
  border-radius: 4px;
166
  }
167
 
168
- .doc-info p {
169
  margin: 5px 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  }
171
 
172
  .doc-content-container {
 
36
  </script>
37
  """
38
 
39
+ # Replace your process_retrieval_text function with this updated version
40
  def process_retrieval_text(retrieval_text, user_input):
41
  """
42
  Process the retrieval text by identifying proper document boundaries
 
70
  # Format with clear section headers and better spacing
71
  formatted_html = f"""
72
  <div class='doc-section'>
73
+ <h3 class="doc-number">Evidence Section {i+1}</h3>
74
+
75
+ <div class="doc-section-info">
76
+ <p><strong>Section Title:</strong> {doc_name}</p>
77
+ <div class="subsection-info">
78
+ <p><strong>Subsection:</strong> Page {page}</p>
79
+ </div>
80
  </div>
81
+
82
  <div class="doc-content-container">
83
  <h4>Content:</h4>
84
  <div class='doc-content'>{content}</div>
 
115
  # Format each chunk with better section styling
116
  chunks = [f"""
117
  <div class='doc-section'>
118
+ <h3 class="doc-title">Evidence Section {i+1}</h3>
119
  <div class='doc-content'>{chunk.strip()}</div>
120
  </div>
121
  """ for i, chunk in enumerate(chunks)]
 
163
  font-size: 18px;
164
  }
165
 
166
+ .doc-section-info {
167
  margin: 10px 0;
168
  padding: 8px;
169
  background: #f5f5f5;
170
  border-radius: 4px;
171
  }
172
 
173
+ .doc-section-info p {
174
  margin: 5px 0;
175
+ font-size: 16px;
176
+ }
177
+
178
+ .subsection-info {
179
+ margin-left: 15px;
180
+ padding-left: 10px;
181
+ border-left: 2px solid #ddd;
182
+ margin-top: 5px;
183
+ }
184
+
185
+ .subsection-info p {
186
+ font-size: 14px;
187
+ color: #555;
188
  }
189
 
190
  .doc-content-container {