ulianast commited on
Commit
36313b3
·
1 Parent(s): b48aa5f

Added Harry Potter analysis

Browse files
Files changed (3) hide show
  1. app.py +36 -7
  2. hp_emotions.pkl +3 -0
  3. hp_goals.pkl +3 -0
app.py CHANGED
@@ -1,14 +1,31 @@
1
- import streamlit as st
2
  import pickle
 
 
 
 
 
 
3
 
4
- st.title("Contact List Analysis")
 
 
 
 
5
 
6
- with open('emotions_report.pkl', 'rb') as file:
7
- emotions_report = pickle.load(file)
8
 
9
- with open('goals_report.pkl', 'rb') as file:
10
- goals_report = pickle.load(file)
 
 
 
 
11
 
 
 
 
 
12
  emotions_tab, goals_tab = st.tabs(["Emotions", "Goals"])
13
 
14
  with emotions_tab:
@@ -49,4 +66,16 @@ with goals_tab:
49
  for ref in r["reference"]:
50
  st.markdown(f"> {ref}")
51
 
52
- st.write("\n")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import pickle
2
+ import math
3
+ import streamlit as st
4
+ import plotly.graph_objects as go
5
+ import matplotlib.pyplot as plt
6
+ import pandas as pd
7
+ import numpy as np
8
 
9
+ reports = {"Hillary Clinton": {"emotions_report_filename" : "emotions_report.pkl",
10
+ "goals_report_filename" : "goals_report.pkl"},
11
+ "Harry Potter": {"emotions_report_filename" : "hp_emotions.pkl",
12
+ "goals_report_filename" : "hp_goals.pkl"}
13
+ }
14
 
15
+ if 'character' not in st.session_state:
16
+ st.session_state.character = "Harry Potter"
17
 
18
+ for ch in reports.keys():
19
+ with open(reports[ch]["goals_report_filename"], 'rb') as file:
20
+ reports[ch]["goals_report"] = pickle.load(file)
21
+
22
+ with open(reports[ch]["emotions_report_filename"], 'rb') as file:
23
+ reports[ch]["emotions_report"] = pickle.load(file)
24
 
25
+ emotions_report = reports[st.session_state.character]["emotions_report"]
26
+ goals_report = reports[st.session_state.character]["goals_report"]
27
+
28
+ st.title(f"{st.session_state.character}'s Contact List Analysis")
29
  emotions_tab, goals_tab = st.tabs(["Emotions", "Goals"])
30
 
31
  with emotions_tab:
 
66
  for ref in r["reference"]:
67
  st.markdown(f"> {ref}")
68
 
69
+ st.write("\n")
70
+
71
+ with st.sidebar:
72
+ for ch in reports.keys():
73
+ container = st.container(border=True)
74
+ col1, col2 = container.columns([2, 1])
75
+
76
+ with col1:
77
+ st.header(ch)
78
+
79
+ with col2:
80
+ st.button("Show", key=ch, on_click=lambda ch=ch: st.session_state.update(character=ch))
81
+
hp_emotions.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f3615d03acc4e804f3867ee464d16ff73a979a3caeb6b05663718cb304f8bcb9
3
+ size 198744
hp_goals.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:48f7d81cd39a3d3ecff90caeec691c22a94c39ebf3c24db5ed3e79857df8414d
3
+ size 125473