CCockrum commited on
Commit
8b7223b
·
verified ·
1 Parent(s): 8beaa28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -163,6 +163,7 @@ def generate_summary(info, ratios):
163
  recommendation = "Buy"
164
  elif ratios['P/E Ratio'] > 30 and ratios['P/B Ratio'] > 5 and ratios['PEG Ratio'] > 2.0:
165
  recommendation = "Sell"
 
166
  report = (
167
  f"Company Overview:\n"
168
  f"Name: {info['Name']}\n"
@@ -177,7 +178,10 @@ def generate_summary(info, ratios):
177
  f"Dividend Yield: {ratios['Dividend Yield']:.2f}%\n\n"
178
  f"Recommended Investment Action: {recommendation}.\n"
179
  )
180
- return summarizer(report, max_length=250, min_length=100, do_sample=False)[0]['summary_text']
 
 
 
181
 
182
  def stock_research(symbol, eps=5.0, growth=0.1, book=500000000):
183
  info = get_company_info(symbol)
 
163
  recommendation = "Buy"
164
  elif ratios['P/E Ratio'] > 30 and ratios['P/B Ratio'] > 5 and ratios['PEG Ratio'] > 2.0:
165
  recommendation = "Sell"
166
+
167
  report = (
168
  f"Company Overview:\n"
169
  f"Name: {info['Name']}\n"
 
178
  f"Dividend Yield: {ratios['Dividend Yield']:.2f}%\n\n"
179
  f"Recommended Investment Action: {recommendation}.\n"
180
  )
181
+
182
+ # Use Mistral to generate the summary
183
+ summary_prompt = f"Summarize the following financial report clearly and briefly:\n\n{report}"
184
+ return query_mistral(summary_prompt)
185
 
186
  def stock_research(symbol, eps=5.0, growth=0.1, book=500000000):
187
  info = get_company_info(symbol)