Spaces:
Running
Running
Commit ·
e627fc2
1
Parent(s): 4bd6649
4.4
Browse files
app.py
CHANGED
|
@@ -636,26 +636,29 @@ class ProcessingUI:
|
|
| 636 |
st.session_state.recent_items.insert(0, new_item)
|
| 637 |
st.session_state.recent_items = st.session_state.recent_items[:10] # Keep last 10 items
|
| 638 |
|
| 639 |
-
#
|
| 640 |
-
|
| 641 |
|
| 642 |
-
# Display items using Streamlit components
|
| 643 |
for item in st.session_state.recent_items:
|
| 644 |
if item['sentiment'] in ['Positive', 'Negative']:
|
| 645 |
-
# Create the display style based on sentiment
|
| 646 |
sentiment_color = "🔴" if item['sentiment'] == 'Negative' else "🟢"
|
| 647 |
event_icon = "📅" if item['event_type'] != 'Нет' else ""
|
| 648 |
|
| 649 |
-
|
| 650 |
-
|
| 651 |
-
|
| 652 |
-
|
| 653 |
-
|
| 654 |
-
|
| 655 |
-
|
| 656 |
-
|
| 657 |
-
|
| 658 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 659 |
|
| 660 |
def setup_main_metrics_tab(self):
|
| 661 |
"""Setup the main metrics display with updated styling"""
|
|
@@ -667,10 +670,10 @@ class ProcessingUI:
|
|
| 667 |
self.speed_metric = metrics_cols[3].empty()
|
| 668 |
|
| 669 |
# Create container for recent items
|
| 670 |
-
st.markdown("###
|
| 671 |
self.recent_items_container = st.empty()
|
| 672 |
|
| 673 |
-
|
| 674 |
def _update_entity_view(self):
|
| 675 |
"""Update entity tab visualizations"""
|
| 676 |
stats = st.session_state.processing_stats['entities']
|
|
@@ -1566,7 +1569,7 @@ def main():
|
|
| 1566 |
st.set_page_config(layout="wide")
|
| 1567 |
|
| 1568 |
with st.sidebar:
|
| 1569 |
-
st.title("::: AI-анализ мониторинга новостей (v.4.
|
| 1570 |
st.subheader("по материалам СКАН-ИНТЕРФАКС")
|
| 1571 |
|
| 1572 |
model_choice = st.radio(
|
|
|
|
| 636 |
st.session_state.recent_items.insert(0, new_item)
|
| 637 |
st.session_state.recent_items = st.session_state.recent_items[:10] # Keep last 10 items
|
| 638 |
|
| 639 |
+
# Prepare markdown for all items
|
| 640 |
+
all_items_markdown = ""
|
| 641 |
|
|
|
|
| 642 |
for item in st.session_state.recent_items:
|
| 643 |
if item['sentiment'] in ['Positive', 'Negative']:
|
|
|
|
| 644 |
sentiment_color = "🔴" if item['sentiment'] == 'Negative' else "🟢"
|
| 645 |
event_icon = "📅" if item['event_type'] != 'Нет' else ""
|
| 646 |
|
| 647 |
+
event_text = f" | Событие: {item['event_type']}" if item['event_type'] != 'Нет' else ""
|
| 648 |
+
|
| 649 |
+
all_items_markdown += f"""
|
| 650 |
+
{sentiment_color} **{item['entity']}** {event_icon}
|
| 651 |
+
|
| 652 |
+
{item['headline']}
|
| 653 |
+
|
| 654 |
+
*{item['sentiment']}*{event_text} | {item['time']}
|
| 655 |
+
|
| 656 |
+
---
|
| 657 |
+
"""
|
| 658 |
+
|
| 659 |
+
# Update container with all items at once
|
| 660 |
+
if all_items_markdown:
|
| 661 |
+
self.recent_items_container.markdown(all_items_markdown)
|
| 662 |
|
| 663 |
def setup_main_metrics_tab(self):
|
| 664 |
"""Setup the main metrics display with updated styling"""
|
|
|
|
| 670 |
self.speed_metric = metrics_cols[3].empty()
|
| 671 |
|
| 672 |
# Create container for recent items
|
| 673 |
+
st.markdown("### негативные/позитивные")
|
| 674 |
self.recent_items_container = st.empty()
|
| 675 |
|
| 676 |
+
|
| 677 |
def _update_entity_view(self):
|
| 678 |
"""Update entity tab visualizations"""
|
| 679 |
stats = st.session_state.processing_stats['entities']
|
|
|
|
| 1569 |
st.set_page_config(layout="wide")
|
| 1570 |
|
| 1571 |
with st.sidebar:
|
| 1572 |
+
st.title("::: AI-анализ мониторинга новостей (v.4.4):::")
|
| 1573 |
st.subheader("по материалам СКАН-ИНТЕРФАКС")
|
| 1574 |
|
| 1575 |
model_choice = st.radio(
|