pentarosarium commited on
Commit
e39a783
·
1 Parent(s): b884013

progress more 57

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -76,6 +76,11 @@ def init_langchain_llm():
76
  model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"
77
  tokenizer, model = load_model(model_id)
78
 
 
 
 
 
 
79
  # Authenticate using the token from Streamlit secrets
80
  if 'hf_token' in st.secrets:
81
  login(token=st.secrets['hf_token'])
@@ -120,6 +125,7 @@ def init_langchain_llm():
120
  st.error(f"Failed to load model: {str(e)}")
121
  st.stop()
122
 
 
123
  def estimate_impact(llm, news_text, entity):
124
  template = """
125
  Analyze the following news piece about the entity "{entity}" and estimate its monetary impact in Russian rubles for this entity in the next 6 months. You should estimate the risk of loss or probability of profit.
@@ -492,7 +498,7 @@ def create_output_file(df, uploaded_file, analysis_df):
492
  return output
493
 
494
  def main():
495
- st.title("... приступим к анализу... версия 56")
496
 
497
  # Initialize session state
498
  if 'processed_df' not in st.session_state:
 
76
  model_id = "meta-llama/Meta-Llama-3.1-8B-Instruct"
77
  tokenizer, model = load_model(model_id)
78
 
79
+ except Exception as e:
80
+ logger.error(f"Error loading model: {str(e)}", exc_info=True)
81
+ st.error(f"Failed to load model: {str(e)}")
82
+ st.stop()
83
+
84
  # Authenticate using the token from Streamlit secrets
85
  if 'hf_token' in st.secrets:
86
  login(token=st.secrets['hf_token'])
 
125
  st.error(f"Failed to load model: {str(e)}")
126
  st.stop()
127
 
128
+
129
  def estimate_impact(llm, news_text, entity):
130
  template = """
131
  Analyze the following news piece about the entity "{entity}" and estimate its monetary impact in Russian rubles for this entity in the next 6 months. You should estimate the risk of loss or probability of profit.
 
498
  return output
499
 
500
  def main():
501
+ st.title("... приступим к анализу... версия 57")
502
 
503
  # Initialize session state
504
  if 'processed_df' not in st.session_state: