Spaces:
Runtime error
Runtime error
Pclanglais
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -110,13 +110,14 @@ def transform_chunks(marianne_segmentation):
|
|
110 |
|
111 |
html_output = []
|
112 |
for _, row in marianne_segmentation.iterrows():
|
113 |
-
entity_group =
|
|
|
114 |
word = row['word']
|
115 |
|
116 |
if entity_group == 'title':
|
117 |
-
html_output.append(f'<div class="manuscript"><div class="annotation">{
|
118 |
else:
|
119 |
-
html_output.append(f'<div class="manuscript"><div class="annotation">{
|
120 |
|
121 |
final_html = '\n'.join(html_output)
|
122 |
return final_html
|
@@ -143,7 +144,7 @@ class MistralChatBot:
|
|
143 |
classified_list.append(df)
|
144 |
|
145 |
classified_list = pd.concat(classified_list)
|
146 |
-
out = transform_chunks(
|
147 |
generated_text = f'{css}<h2 style="text-align:center">Réponse</h2>\n<div class="generation">{out}</div>'
|
148 |
return generated_text
|
149 |
|
|
|
110 |
|
111 |
html_output = []
|
112 |
for _, row in marianne_segmentation.iterrows():
|
113 |
+
entity_group = row['entity_group']
|
114 |
+
result_entity = "<" + entity_group.capitalize() + ">"
|
115 |
word = row['word']
|
116 |
|
117 |
if entity_group == 'title':
|
118 |
+
html_output.append(f'<div class="manuscript"><div class="annotation">{result_entity}</div><div class="content title-content"><h2>{word}</h2></div></div>')
|
119 |
else:
|
120 |
+
html_output.append(f'<div class="manuscript"><div class="annotation">{result_entity}</div><div class="content">{word}</div></div>')
|
121 |
|
122 |
final_html = '\n'.join(html_output)
|
123 |
return final_html
|
|
|
144 |
classified_list.append(df)
|
145 |
|
146 |
classified_list = pd.concat(classified_list)
|
147 |
+
out = transform_chunks(classified_list)
|
148 |
generated_text = f'{css}<h2 style="text-align:center">Réponse</h2>\n<div class="generation">{out}</div>'
|
149 |
return generated_text
|
150 |
|