Spaces:
Sleeping
Sleeping
Commit
·
27bf06e
1
Parent(s):
96fddb9
progress more (3.16)
Browse files
app.py
CHANGED
|
@@ -151,15 +151,8 @@ def fuzzy_deduplicate(df, column, threshold=65):
|
|
| 151 |
indices_to_keep.append(i)
|
| 152 |
return df.iloc[indices_to_keep]
|
| 153 |
|
| 154 |
-
def init_langchain_llm():
|
| 155 |
try:
|
| 156 |
-
# Get model selection from sidebar with unique key
|
| 157 |
-
model_choice = st.sidebar.radio(
|
| 158 |
-
"Выберите модель для анализа:",
|
| 159 |
-
["Groq (llama-3.1-70b)", "ChatGPT-4-mini", "NVIDIA Nemotron-70B"],
|
| 160 |
-
key="model_selector_radio" # Added unique key
|
| 161 |
-
)
|
| 162 |
-
|
| 163 |
if model_choice == "Groq (llama-3.1-70b)":
|
| 164 |
if 'groq_key' not in st.secrets:
|
| 165 |
st.error("Groq API key not found in secrets. Please add it with the key 'groq_key'.")
|
|
@@ -464,8 +457,15 @@ def create_output_file(df, uploaded_file, llm):
|
|
| 464 |
|
| 465 |
def main():
|
| 466 |
with st.sidebar:
|
| 467 |
-
st.title("::: AI-анализ мониторинга новостей (v.3.
|
| 468 |
st.subheader("по материалам СКАН-ИНТЕРФАКС ")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 469 |
st.markdown(
|
| 470 |
"""
|
| 471 |
Использованы технологии:
|
|
@@ -514,6 +514,11 @@ def main():
|
|
| 514 |
if uploaded_file is not None and st.session_state.processed_df is None:
|
| 515 |
start_time = time.time()
|
| 516 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 517 |
st.session_state.processed_df = process_file(uploaded_file)
|
| 518 |
|
| 519 |
st.subheader("Предпросмотр данных")
|
|
@@ -524,7 +529,7 @@ def main():
|
|
| 524 |
st.subheader("Анализ")
|
| 525 |
st.dataframe(analysis_df)
|
| 526 |
|
| 527 |
-
|
| 528 |
output = create_output_file(st.session_state.processed_df, uploaded_file, llm)
|
| 529 |
|
| 530 |
end_time = time.time()
|
|
|
|
| 151 |
indices_to_keep.append(i)
|
| 152 |
return df.iloc[indices_to_keep]
|
| 153 |
|
| 154 |
+
def init_langchain_llm(model_choice):
|
| 155 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
if model_choice == "Groq (llama-3.1-70b)":
|
| 157 |
if 'groq_key' not in st.secrets:
|
| 158 |
st.error("Groq API key not found in secrets. Please add it with the key 'groq_key'.")
|
|
|
|
| 457 |
|
| 458 |
def main():
|
| 459 |
with st.sidebar:
|
| 460 |
+
st.title("::: AI-анализ мониторинга новостей (v.3.16):::")
|
| 461 |
st.subheader("по материалам СКАН-ИНТЕРФАКС ")
|
| 462 |
+
|
| 463 |
+
model_choice = st.radio(
|
| 464 |
+
"Выберите модель для анализа:",
|
| 465 |
+
["Groq (llama-3.1-70b)", "ChatGPT-4-mini", "NVIDIA Nemotron-70B"],
|
| 466 |
+
key="model_selector"
|
| 467 |
+
)
|
| 468 |
+
|
| 469 |
st.markdown(
|
| 470 |
"""
|
| 471 |
Использованы технологии:
|
|
|
|
| 514 |
if uploaded_file is not None and st.session_state.processed_df is None:
|
| 515 |
start_time = time.time()
|
| 516 |
|
| 517 |
+
|
| 518 |
+
# Initialize LLM with selected model
|
| 519 |
+
llm = init_langchain_llm(model_choice)
|
| 520 |
+
|
| 521 |
+
|
| 522 |
st.session_state.processed_df = process_file(uploaded_file)
|
| 523 |
|
| 524 |
st.subheader("Предпросмотр данных")
|
|
|
|
| 529 |
st.subheader("Анализ")
|
| 530 |
st.dataframe(analysis_df)
|
| 531 |
|
| 532 |
+
|
| 533 |
output = create_output_file(st.session_state.processed_df, uploaded_file, llm)
|
| 534 |
|
| 535 |
end_time = time.time()
|