Spaces:
Running
Running
Commit ·
723da90
1
Parent(s): 027d010
4.1
Browse files
app.py
CHANGED
|
@@ -662,38 +662,45 @@ class ProcessingUI:
|
|
| 662 |
st.session_state.recent_items.insert(0, new_item)
|
| 663 |
st.session_state.recent_items = st.session_state.recent_items[:10] # Keep last 10 items
|
| 664 |
|
| 665 |
-
#
|
| 666 |
-
|
| 667 |
-
|
| 668 |
-
|
| 669 |
-
|
| 670 |
-
|
| 671 |
-
|
| 672 |
-
|
| 673 |
-
|
| 674 |
-
|
| 675 |
-
|
| 676 |
-
|
| 677 |
-
|
| 678 |
-
|
| 679 |
-
|
| 680 |
-
|
| 681 |
-
|
| 682 |
-
|
| 683 |
-
|
| 684 |
-
|
| 685 |
-
|
| 686 |
-
|
| 687 |
-
<div style='margin: 5px 0;'>{item['headline']}</div>
|
| 688 |
-
<div style='font-size: 0.9em; color: #666;'>
|
| 689 |
-
Тональность: {item['sentiment']}
|
| 690 |
-
{f" | Событие: {item['event_type']}" if item['event_type'] != 'Нет' else ""}
|
| 691 |
-
| {item['time']}
|
| 692 |
-
</div>
|
| 693 |
</div>
|
| 694 |
-
|
| 695 |
-
|
| 696 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 697 |
|
| 698 |
def _update_entity_view(self):
|
| 699 |
"""Update entity tab visualizations"""
|
|
@@ -1590,7 +1597,7 @@ def main():
|
|
| 1590 |
st.set_page_config(layout="wide")
|
| 1591 |
|
| 1592 |
with st.sidebar:
|
| 1593 |
-
st.title("::: AI-анализ мониторинга новостей (v.4.
|
| 1594 |
st.subheader("по материалам СКАН-ИНТЕРФАКС")
|
| 1595 |
|
| 1596 |
model_choice = st.radio(
|
|
|
|
| 662 |
st.session_state.recent_items.insert(0, new_item)
|
| 663 |
st.session_state.recent_items = st.session_state.recent_items[:10] # Keep last 10 items
|
| 664 |
|
| 665 |
+
# Create combined markdown for all items
|
| 666 |
+
all_items_markdown = ""
|
| 667 |
+
for item in st.session_state.recent_items:
|
| 668 |
+
if item['sentiment'] in ['Positive', 'Negative']:
|
| 669 |
+
# Create color based on sentiment
|
| 670 |
+
color = "#FF6B6B" if item['sentiment'] == 'Negative' else "#4ECDC4"
|
| 671 |
+
|
| 672 |
+
# Add item markdown
|
| 673 |
+
all_items_markdown += f"""
|
| 674 |
+
<div style='
|
| 675 |
+
padding: 10px;
|
| 676 |
+
margin-bottom: 10px;
|
| 677 |
+
border-radius: 4px;
|
| 678 |
+
background-color: #f8f9fa;
|
| 679 |
+
border-left: 4px solid {color};
|
| 680 |
+
'>
|
| 681 |
+
<div style='font-weight: bold;'>{item['entity']}</div>
|
| 682 |
+
<div style='margin: 5px 0;'>{item['headline']}</div>
|
| 683 |
+
<div style='font-size: 0.9em; color: #666;'>
|
| 684 |
+
Тональность: {item['sentiment']}
|
| 685 |
+
{f" | Событие: {item['event_type']}" if item['event_type'] != 'Нет' else ""}
|
| 686 |
+
| {item['time']}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 687 |
</div>
|
| 688 |
+
</div>
|
| 689 |
+
"""
|
| 690 |
+
|
| 691 |
+
# Add wrapper for scrolling
|
| 692 |
+
final_markdown = f"""
|
| 693 |
+
<div style='
|
| 694 |
+
max-height: 400px;
|
| 695 |
+
overflow-y: auto;
|
| 696 |
+
padding-right: 10px;
|
| 697 |
+
'>
|
| 698 |
+
{all_items_markdown}
|
| 699 |
+
</div>
|
| 700 |
+
"""
|
| 701 |
+
|
| 702 |
+
# Update the container with all items at once
|
| 703 |
+
self.recent_items_container.markdown(final_markdown, unsafe_allow_html=True)
|
| 704 |
|
| 705 |
def _update_entity_view(self):
|
| 706 |
"""Update entity tab visualizations"""
|
|
|
|
| 1597 |
st.set_page_config(layout="wide")
|
| 1598 |
|
| 1599 |
with st.sidebar:
|
| 1600 |
+
st.title("::: AI-анализ мониторинга новостей (v.4.1):::")
|
| 1601 |
st.subheader("по материалам СКАН-ИНТЕРФАКС")
|
| 1602 |
|
| 1603 |
model_choice = st.radio(
|