Spaces:
Running
Running
Commit ·
f2d6172
1
Parent(s): fe44f70
4.11
Browse files
app.py
CHANGED
|
@@ -1407,7 +1407,7 @@ def translate_reasoning_to_russian(llm, text):
|
|
| 1407 |
return str(response).strip()
|
| 1408 |
|
| 1409 |
|
| 1410 |
-
def create_output_file(df, uploaded_file
|
| 1411 |
"""Create Excel file with multiple sheets from processed DataFrame"""
|
| 1412 |
try:
|
| 1413 |
wb = load_workbook("sample_file.xlsx")
|
|
@@ -1447,7 +1447,7 @@ def create_output_file(df, uploaded_file, llm):
|
|
| 1447 |
# Get impact for entity
|
| 1448 |
entity_df = df[df['Объект'] == entity]
|
| 1449 |
negative_df = entity_df[entity_df['Sentiment'] == 'Negative']
|
| 1450 |
-
impact = negative_df['Impact'].iloc[0] if len(negative_df) > 0 else '
|
| 1451 |
ws.cell(row=idx, column=9, value=impact)
|
| 1452 |
|
| 1453 |
# 4. Update 'Значимые' sheet
|
|
@@ -1458,7 +1458,7 @@ def create_output_file(df, uploaded_file, llm):
|
|
| 1458 |
ws.cell(row=row_idx, column=3, value=row['Объект'])
|
| 1459 |
ws.cell(row=row_idx, column=4, value='релевантно')
|
| 1460 |
ws.cell(row=row_idx, column=5, value=row['Sentiment'])
|
| 1461 |
-
ws.cell(row=row_idx, column=6, value=row.get('Impact', '
|
| 1462 |
ws.cell(row=row_idx, column=7, value=row['Заголовок'])
|
| 1463 |
ws.cell(row=row_idx, column=8, value=row['Выдержки из текста'])
|
| 1464 |
row_idx += 1
|
|
@@ -1471,7 +1471,7 @@ def create_output_file(df, uploaded_file, llm):
|
|
| 1471 |
ws.cell(row=row_idx, column=5, value=row['Объект'])
|
| 1472 |
ws.cell(row=row_idx, column=6, value=row['Заголовок'])
|
| 1473 |
ws.cell(row=row_idx, column=7, value="Риск убытка")
|
| 1474 |
-
ws.cell(row=row_idx, column=8, value=row.get('Reasoning', '
|
| 1475 |
ws.cell(row=row_idx, column=9, value=row['Выдержки из текста'])
|
| 1476 |
row_idx += 1
|
| 1477 |
|
|
@@ -1503,7 +1503,7 @@ def main():
|
|
| 1503 |
st.set_page_config(layout="wide")
|
| 1504 |
|
| 1505 |
with st.sidebar:
|
| 1506 |
-
st.title("::: AI-анализ мониторинга новостей (v.4.
|
| 1507 |
st.subheader("по материалам СКАН-ИНТЕРФАКС")
|
| 1508 |
|
| 1509 |
model_choice = st.radio(
|
|
|
|
| 1407 |
return str(response).strip()
|
| 1408 |
|
| 1409 |
|
| 1410 |
+
def create_output_file(df, uploaded_file):
|
| 1411 |
"""Create Excel file with multiple sheets from processed DataFrame"""
|
| 1412 |
try:
|
| 1413 |
wb = load_workbook("sample_file.xlsx")
|
|
|
|
| 1447 |
# Get impact for entity
|
| 1448 |
entity_df = df[df['Объект'] == entity]
|
| 1449 |
negative_df = entity_df[entity_df['Sentiment'] == 'Negative']
|
| 1450 |
+
impact = negative_df['Impact'].iloc[0] if len(negative_df) > 0 else '-'
|
| 1451 |
ws.cell(row=idx, column=9, value=impact)
|
| 1452 |
|
| 1453 |
# 4. Update 'Значимые' sheet
|
|
|
|
| 1458 |
ws.cell(row=row_idx, column=3, value=row['Объект'])
|
| 1459 |
ws.cell(row=row_idx, column=4, value='релевантно')
|
| 1460 |
ws.cell(row=row_idx, column=5, value=row['Sentiment'])
|
| 1461 |
+
ws.cell(row=row_idx, column=6, value=row.get('Impact', '-'))
|
| 1462 |
ws.cell(row=row_idx, column=7, value=row['Заголовок'])
|
| 1463 |
ws.cell(row=row_idx, column=8, value=row['Выдержки из текста'])
|
| 1464 |
row_idx += 1
|
|
|
|
| 1471 |
ws.cell(row=row_idx, column=5, value=row['Объект'])
|
| 1472 |
ws.cell(row=row_idx, column=6, value=row['Заголовок'])
|
| 1473 |
ws.cell(row=row_idx, column=7, value="Риск убытка")
|
| 1474 |
+
ws.cell(row=row_idx, column=8, value=row.get('Reasoning', '-'))
|
| 1475 |
ws.cell(row=row_idx, column=9, value=row['Выдержки из текста'])
|
| 1476 |
row_idx += 1
|
| 1477 |
|
|
|
|
| 1503 |
st.set_page_config(layout="wide")
|
| 1504 |
|
| 1505 |
with st.sidebar:
|
| 1506 |
+
st.title("::: AI-анализ мониторинга новостей (v.4.11):::")
|
| 1507 |
st.subheader("по материалам СКАН-ИНТЕРФАКС")
|
| 1508 |
|
| 1509 |
model_choice = st.radio(
|