zoya23 commited on
Commit
7e5aa7c
·
verified ·
1 Parent(s): 1623b7c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -10
app.py CHANGED
@@ -1,18 +1,40 @@
1
  import streamlit as st
2
- import requests
 
 
 
3
  from agents.voice_agent import speech_to_text, text_to_speech
4
 
5
- st.title("🧠 Morning Market Brief - Finance Assistant")
 
6
 
7
- option = st.radio("Input Mode", ["Voice", "Click Button"])
8
- if option == "Voice":
9
- query = speech_to_text()
10
- st.write(f"You said: {query}")
 
 
 
 
 
11
  else:
12
- if st.button("Get Morning Brief"):
13
  query = "What's our risk exposure in Asia tech stocks today?"
14
 
15
  if query:
16
- response = requests.get("http://localhost:8000/market-brief").json()
17
- st.success(response['brief'])
18
- text_to_speech(response['brief'])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ from agents.api_agent import get_asia_tech_risk
3
+ from agents.scraping_agent import get_earnings_news
4
+ from agents.analysis_agent import get_aum_change, earnings_summary
5
+ from agents.language_agent import generate_brief
6
  from agents.voice_agent import speech_to_text, text_to_speech
7
 
8
+ st.set_page_config(page_title="🧠 Finance Assistant", layout="centered")
9
+ st.title("🧠 Morning Market Brief - Voice Assistant")
10
 
11
+ st.markdown("Ask: _What's our risk exposure in Asia tech stocks today?_")
12
+
13
+ input_mode = st.radio("Choose input mode", ["🎤 Voice", "⌨️ Button"])
14
+
15
+ query = ""
16
+ if input_mode == "🎤 Voice":
17
+ if st.button("Record Voice"):
18
+ query = speech_to_text()
19
+ st.write("You said:", query)
20
  else:
21
+ if st.button("Get Market Brief"):
22
  query = "What's our risk exposure in Asia tech stocks today?"
23
 
24
  if query:
25
+ # Get agent responses
26
+ stocks = get_asia_tech_risk(['TSM', 'SSNLF'])
27
+ news = get_earnings_news()
28
+ earnings = earnings_summary(stocks)
29
+ aum_change = get_aum_change(22, 18)
30
+ narrative = generate_brief(query)
31
+
32
+ final_brief = (
33
+ f"Today, your Asia tech allocation is 22% of AUM, up from 18% yesterday.\n\n"
34
+ f"Earnings Summary: {earnings}.\n\n"
35
+ f"Top Headlines:\n" + "\n".join([f"- {h}" for h in news]) + "\n\n"
36
+ f"{narrative}"
37
+ )
38
+
39
+ st.success(final_brief)
40
+ text_to_speech(final_brief)