Spaces:
Runtime error
Runtime error
Upload app.py
Browse files5 unmodified lines67891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231245 unmodified linesimport pandas as pdimport matplotlib.pyplot as pltst.set_page_config(page_title="RTM Assistant", layout="wide")if "rtm_text" not in st.session_state:st.session_state["rtm_text"] = ""if "prospecting_msg" not in st.session_state:st.session_state["prospecting_msg"] = ""if "followup_msg" not in st.session_state:st.session_state["followup_msg"] = ""tab1, tab2 = st.tabs(["π RTM + Prospecting", "π App Usage Log"])with tab1:st.title("π RTM Generator for Account Research")workspace = st.text_input("Step 1: Enter your workspace name")if not workspace:st.warning("Please enter your workspace name to proceed.")st.stop()rtm_file_path = f"rtms_{workspace}.json"if os.path.exists(rtm_file_path):with open(rtm_file_path, "r") as f:rtm_storage = json.load(f)else:rtm_storage = {}st.subheader("Step 2: Generate or Refresh RTM Report")company = st.text_input("Enter company name")website = st.text_input("Enter company website")col1, col2 = st.columns([1, 1])with col1:if st.button("π Generate RTM Report"):with st.spinner("Generating RTM Report..."):rtm_text = generate_rtm(company, website, workspace=workspace)st.session_state["rtm_text"] = rtm_textrtm_storage[company] = rtm_textwith open(rtm_file_path, "w") as f:json.dump(rtm_storage, f, indent=2)st.success("RTM Report generated and saved.")with col2:if st.button("π Refresh RTM"):if company in rtm_storage:with st.spinner("Refreshing RTM Report..."):rtm_text = generate_rtm(company, website, workspace=workspace)st.session_state["rtm_text"] = rtm_textrtm_storage[company] = rtm_textwith open(rtm_file_path, "w") as f:json.dump(rtm_storage, f, indent=2)st.success("RTM Report refreshed.")else:st.error("No existing RTM found to refresh.")if st.session_state["rtm_text"]:st.text_area("RTM Report", st.session_state["rtm_text"], height=400)st.subheader("Step 3: Generate Contact-Specific Prospecting Message")linkedin_url_raw = st.text_input("Prospect's LinkedIn URL")persona = st.selectbox("Prospect Persona (optional)", ["", "Engineering Leader", "Operations Leader", "IT Executive"])custom_persona = st.text_input("Or enter a custom persona (optional)", "")persona = custom_persona if custom_persona else personaprospect_context = st.text_area("Relevant Info (optional)")if st.button("βοΈ Generate Prospecting Message"):with st.spinner("Generating message..."):linkedin_url = sanitize_linkedin_url(linkedin_url_raw)st.session_state["linkedin_url"] = linkedin_urlenriched_context = f"{prospect_context}\n\nPersona: {persona}"st.session_state["prospecting_msg"] = generate_prospecting_message(linkedin_url, enriched_context, st.session_state["rtm_text"], workspace=workspace)st.success("Prospecting message generated.")if st.session_state["prospecting_msg"]:st.text_area("Prospecting Message", st.session_state["prospecting_msg"], height=300)if st.session_state["prospecting_msg"]:if st.button("π Generate Follow-Up Message"):with st.spinner("Generating follow-up..."):enriched_context = f"{prospect_context}\n\nPersona: {persona}\n\nContext: This is a follow-up message."st.session_state["followup_msg"] = generate_prospecting_message(st.session_state.get("linkedin_url", ""), enriched_context, st.session_state["rtm_text"],workspace=workspace, is_followup=True)st.success("Follow-up message generated.")if st.session_state["followup_msg"]:st.text_area("Follow-Up Message", st.session_state["followup_msg"], height=300)with tab2:st.title("π App Usage Log")log_path = "logs/usage_log.json"if os.path.exists(log_path):with open(log_path) as f:data = json.load(f)df = pd.DataFrame(data)df["timestamp"] = pd.to_datetime(df["timestamp"])df = df.sort_values("timestamp", ascending=False)st.subheader("Raw Log Data")st.dataframe(df, use_container_width=True, height=300)st.subheader("Events by Type")event_counts = df["event_type"].value_counts()st.bar_chart(event_counts)st.subheader("Events Over Time")df["hour"] = df["timestamp"].dt.floor("h")timeline = df.groupby("hour").size()st.line_chart(timeline)st.subheader("Events by Workspace")workspace_counts = df["workspace"].value_counts()st.bar_chart(workspace_counts)else:st.info("No usage logs yet. Once users interact with the app, logs will appear here.")5 unmodified lines6789101112131415161718192021225 unmodified linesimport pandas as pdimport matplotlib.pyplot as pltst.set_page_config(page_title="Reason to Meet", layout="wide")st.title("π Reason to Meet")with st.expander("βΉοΈ What is this app?", expanded=False):st.markdown("""**Reason to Meet** helps Enterprise Account Executives create strategic insights and outreach messaging.It generates:- A comprehensive business research summary for a target account (called the "Reason to Meet")- Personalized prospecting messages tied to that researchAll messages are grounded in public information and aligned to PagerDuty's value proposition.""")
app.py+11-113