Spaces:
Sleeping
Sleeping
Switch quotes for Python 3.11
Browse files
finance-app-tutorial/main.py
CHANGED
@@ -34,12 +34,12 @@ def _refresh_window(state):
|
|
34 |
# Summarize earnings call using Palmyra-Fin model
|
35 |
def summarize_earnings(state):
|
36 |
_refresh_window(state)
|
37 |
-
state["message"] = f"% {state[
|
38 |
|
39 |
earnings_transcript = state["earnings_transcript"]
|
40 |
prompt = earnings_prompt.format(earnings_transcript=earnings_transcript)
|
41 |
submission = writer.ai.complete(prompt, config={"model": "palmyra-fin-32k", "temperature": 0.7, "max_tokens": 8192})
|
42 |
-
state["message"] = f"+ {state[
|
43 |
state["analysis"] = submission.strip()
|
44 |
state["show_analysis_text"]["visible"] = True
|
45 |
|
@@ -56,7 +56,7 @@ def generate_stock_analysis(state):
|
|
56 |
if(state["prompt_parameters_lang"] == ""):
|
57 |
state["prompt_parameters_lang"] == "English"
|
58 |
|
59 |
-
state["message"] = f"% {state[
|
60 |
stock_name = state["symbol"]
|
61 |
stock_data = state["main_df"][:365]
|
62 |
|
@@ -68,7 +68,7 @@ def generate_stock_analysis(state):
|
|
68 |
prompt = stock_prompts.format(language=language, stock_name=stock_name,words=integer_value,stock_data=stock_data)
|
69 |
submission = writer.ai.complete(prompt, config={"model": "palmyra-fin-32k", "temperature": 0.7, "max_tokens": 8192})
|
70 |
state["analysis"] = submission.strip()
|
71 |
-
state["message"] = f"+ {state[
|
72 |
state["show_analysis_text"]["visible"] = True
|
73 |
state["show_analysis_text"]["language"] = True
|
74 |
|
@@ -77,7 +77,7 @@ def generate_stock_analysis(state):
|
|
77 |
|
78 |
def generate_income_analysis(state):
|
79 |
_refresh_window(state)
|
80 |
-
state["message"] = f"% {state[
|
81 |
stock_name = state["symbol"]
|
82 |
stock_data = state["main_df"][:365]
|
83 |
income_statement_data = state["income_statement_df"][:365]
|
@@ -88,7 +88,7 @@ def generate_income_analysis(state):
|
|
88 |
)
|
89 |
submission = writer.ai.complete(prompt, config={"model": "palmyra-fin-32k", "temperature": 0.7, "max_tokens": 8192})
|
90 |
state["analysis"] = submission.strip()
|
91 |
-
state["message"] = f"+ {state[
|
92 |
state["show_income_metrics"]["visible"] = True
|
93 |
state["show_analysis_text"]["visible"] = True
|
94 |
state["show_bar_graph"]["visible"] = True
|
|
|
34 |
# Summarize earnings call using Palmyra-Fin model
|
35 |
def summarize_earnings(state):
|
36 |
_refresh_window(state)
|
37 |
+
state["message"] = f"% {state['symbol']} earnings call will be summarized here"
|
38 |
|
39 |
earnings_transcript = state["earnings_transcript"]
|
40 |
prompt = earnings_prompt.format(earnings_transcript=earnings_transcript)
|
41 |
submission = writer.ai.complete(prompt, config={"model": "palmyra-fin-32k", "temperature": 0.7, "max_tokens": 8192})
|
42 |
+
state["message"] = f"+ {state['symbol']} earnings call summary"
|
43 |
state["analysis"] = submission.strip()
|
44 |
state["show_analysis_text"]["visible"] = True
|
45 |
|
|
|
56 |
if(state["prompt_parameters_lang"] == ""):
|
57 |
state["prompt_parameters_lang"] == "English"
|
58 |
|
59 |
+
state["message"] = f"% {state['symbol']} trends will be analyzed here in {state['prompt_parameters_lang']}"
|
60 |
stock_name = state["symbol"]
|
61 |
stock_data = state["main_df"][:365]
|
62 |
|
|
|
68 |
prompt = stock_prompts.format(language=language, stock_name=stock_name,words=integer_value,stock_data=stock_data)
|
69 |
submission = writer.ai.complete(prompt, config={"model": "palmyra-fin-32k", "temperature": 0.7, "max_tokens": 8192})
|
70 |
state["analysis"] = submission.strip()
|
71 |
+
state["message"] = f"+ {state['symbol']} trends analyzed"
|
72 |
state["show_analysis_text"]["visible"] = True
|
73 |
state["show_analysis_text"]["language"] = True
|
74 |
|
|
|
77 |
|
78 |
def generate_income_analysis(state):
|
79 |
_refresh_window(state)
|
80 |
+
state["message"] = f"% {state['symbol']} income statement will be visualized here"
|
81 |
stock_name = state["symbol"]
|
82 |
stock_data = state["main_df"][:365]
|
83 |
income_statement_data = state["income_statement_df"][:365]
|
|
|
88 |
)
|
89 |
submission = writer.ai.complete(prompt, config={"model": "palmyra-fin-32k", "temperature": 0.7, "max_tokens": 8192})
|
90 |
state["analysis"] = submission.strip()
|
91 |
+
state["message"] = f"+ {state['symbol']} income statement visualized"
|
92 |
state["show_income_metrics"]["visible"] = True
|
93 |
state["show_analysis_text"]["visible"] = True
|
94 |
state["show_bar_graph"]["visible"] = True
|