Spaces:
Running
Running
Comments cleaned
Browse files
app.py
CHANGED
@@ -50,8 +50,6 @@ we_are_not_online = not we_are_online
|
|
50 |
|
51 |
golden_dataset = EmbeddingQAFinetuneDataset.from_json("data/golden_100.json")
|
52 |
|
53 |
-
# shutil.rmtree("models/models") # remove it - I wanted to clear the space on streamlit online
|
54 |
-
|
55 |
## PAGE CONFIGURATION
|
56 |
st.set_page_config(page_title="Ask Impact Theory",
|
57 |
page_icon="assets/impact-theory-logo-only.png",
|
@@ -78,66 +76,14 @@ def add_bg_from_local(image_file):
|
|
78 |
|
79 |
st.markdown(page_bg_img, unsafe_allow_html=True)
|
80 |
|
81 |
-
# COMMENT: I tried to create a dropdown menu but it's harder than it looks, so I gave up
|
82 |
-
# https://discuss.streamlit.io/t/streamlit-option-menu-is-a-simple-streamlit-component-that-allows-users-to-select-a-single-item-from-a-list-of-options-in-a-menu/20514
|
83 |
-
# not great, but it works
|
84 |
-
# selected = option_menu("About", ["Improvements","This"], #"Main Menu", ["Home", 'Settings'],
|
85 |
-
# icons=['house', 'gear'],
|
86 |
-
# menu_icon="cast",
|
87 |
-
# default_index=1)
|
88 |
-
|
89 |
-
# # Custom HTML/CSS for the banner
|
90 |
-
# base64_img = get_base64_of_bin_file("assets/it_tom_bilyeu.png")
|
91 |
-
# banner_menu_html = f"""
|
92 |
-
# <div class="banner">
|
93 |
-
# <img src= "data:image/png;base64,{base64_img}" alt="Banner Image">
|
94 |
-
# </div>
|
95 |
-
# <style>
|
96 |
-
# .banner {{
|
97 |
-
# width: 100%;
|
98 |
-
# height: auto;
|
99 |
-
# overflow: hidden;
|
100 |
-
# display: flex;
|
101 |
-
# justify-content: center;
|
102 |
-
# }}
|
103 |
-
# .banner img {{
|
104 |
-
# width: 130%;
|
105 |
-
# height: auto;
|
106 |
-
# object-fit: contain;
|
107 |
-
# }}
|
108 |
-
# </style>
|
109 |
-
# """
|
110 |
-
# st.components.v1.html(banner_menu_html)
|
111 |
-
|
112 |
-
|
113 |
-
# specify the primary menu definition
|
114 |
-
# it gives a vertical menu inside a navigation bar !!!
|
115 |
-
# menu_data = [
|
116 |
-
# {'icon': "far fa-copy", 'label':"Left End"},
|
117 |
-
# {'id':'Copy','icon':"π",'label':"Copy"},
|
118 |
-
# {'icon': "far fa-chart-bar", 'label':"Chart"},#no tooltip message
|
119 |
-
# {'icon': "far fa-address-book", 'label':"Book"},
|
120 |
-
# {'id':' Crazy return value π','icon': "π", 'label':"Calendar"},
|
121 |
-
# {'icon': "far fa-clone", 'label':"Component"},
|
122 |
-
# {'icon': "fas fa-tachometer-alt", 'label':"Dashboard",'ttip':"I'm the Dashboard tooltip!"}, #can add a tooltip message
|
123 |
-
# {'icon': "far fa-copy", 'label':"Right End"},
|
124 |
-
# ]
|
125 |
-
# # we can override any part of the primary colors of the menu
|
126 |
-
# over_theme = {'txc_inactive': '#FFFFFF','menu_background':'red','txc_active':'yellow','option_active':'blue'}
|
127 |
-
# # over_theme = {'txc_inactive': '#FFFFFF'}
|
128 |
-
# menu_id = hc.nav_bar(menu_definition=menu_data,
|
129 |
-
# home_name='Home',
|
130 |
-
# override_theme=over_theme)
|
131 |
-
#get the id of the menu item clicked
|
132 |
-
# st.info(f"{menu_id=}")
|
133 |
## RERANKER
|
134 |
reranker = ReRanker('cross-encoder/ms-marco-MiniLM-L-6-v2')
|
135 |
## ENCODING --> tiktoken library
|
136 |
model_ids = ['gpt-3.5-turbo-16k', 'gpt-3.5-turbo-0613']
|
137 |
model_nameGPT = model_ids[1]
|
138 |
encoding = encoding_for_model(model_nameGPT)
|
139 |
-
|
140 |
-
|
141 |
data_path = './data/impact_theory_data.json'
|
142 |
cache_path = 'data/impact_theory_cache.parquet'
|
143 |
data = load_data(data_path)
|
|
|
50 |
|
51 |
golden_dataset = EmbeddingQAFinetuneDataset.from_json("data/golden_100.json")
|
52 |
|
|
|
|
|
53 |
## PAGE CONFIGURATION
|
54 |
st.set_page_config(page_title="Ask Impact Theory",
|
55 |
page_icon="assets/impact-theory-logo-only.png",
|
|
|
76 |
|
77 |
st.markdown(page_bg_img, unsafe_allow_html=True)
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
## RERANKER
|
80 |
reranker = ReRanker('cross-encoder/ms-marco-MiniLM-L-6-v2')
|
81 |
## ENCODING --> tiktoken library
|
82 |
model_ids = ['gpt-3.5-turbo-16k', 'gpt-3.5-turbo-0613']
|
83 |
model_nameGPT = model_ids[1]
|
84 |
encoding = encoding_for_model(model_nameGPT)
|
85 |
+
|
86 |
+
## DATA
|
87 |
data_path = './data/impact_theory_data.json'
|
88 |
cache_path = 'data/impact_theory_cache.parquet'
|
89 |
data = load_data(data_path)
|