JPBianchi commited on
Commit
8ee27bb
1 Parent(s): 9531574

More cleaning

Browse files
Files changed (1) hide show
  1. app.shell.py +0 -143
app.shell.py DELETED
@@ -1,143 +0,0 @@
1
- from tiktoken import get_encoding
2
- from weaviate_interface import WeaviateClient
3
- from prompt_templates import question_answering_prompt_series, question_answering_system
4
- from openai_interface import GPT_Turbo
5
- from app_features import (convert_seconds, generate_prompt_series, search_result,
6
- validate_token_threshold, load_content_cache, load_data)
7
- from reranker import ReRanker
8
- from loguru import logger
9
- import streamlit as st
10
- import sys
11
- import json
12
- import os
13
-
14
- # load environment variables
15
- from dotenv import load_dotenv
16
- load_dotenv('.env', override=True)
17
-
18
- ## PAGE CONFIGURATION
19
- st.set_page_config(page_title="Impact Theory",
20
- page_icon=None,
21
- layout="wide",
22
- initial_sidebar_state="auto",
23
- menu_items=None)
24
- ##############
25
- # START CODE #
26
- ##############
27
- data_path = 'data/impact_theory_data.json'
28
- cache_path = 'data/impact_theory_cache.parquet'
29
- data = load_data(data_path)
30
- cache = load_content_cache(cache_path)
31
- ## RETRIEVER
32
- client.display_properties.append('summary')
33
- ## RERANKER
34
-
35
- ## LLM
36
-
37
- ## ENCODING
38
-
39
- ## INDEX NAME
40
-
41
- ##############
42
- # END CODE #
43
- ##############
44
- data = load_data(data_path)
45
- #creates list of guests for sidebar
46
- guest_list = sorted(list(set([d['guest'] for d in data])))
47
-
48
- def main():
49
-
50
- with st.sidebar:
51
- guest = st.selectbox('Select Guest', options=guest_list, index=None, placeholder='Select Guest')
52
-
53
- st.image('./assets/impact-theory-logo.png', width=400)
54
- st.subheader(f"Chat with the Impact Theory podcast: ")
55
- st.write('\n')
56
- col1, _ = st.columns([7,3])
57
- with col1:
58
- query = st.text_input('Enter your question: ')
59
- st.write('\n\n\n\n\n')
60
-
61
- if query:
62
- ##############
63
- # START CODE #
64
- ##############
65
-
66
- st.write('Hmmm...this app does not seem to be working yet. Please check back later.')
67
- if guest:
68
- st.write(f'However, it looks like you selected {guest} as a filter.')
69
- # make hybrid call to weaviate
70
- hybrid_response = None
71
- # rerank results
72
- ranked_response = None
73
- # validate token count is below threshold
74
- # valid_response = validate_token_threshold(ranked_response,
75
- # question_answering_prompt_series,
76
- # query=query,
77
- # tokenizer= # variable from ENCODING,
78
- # token_threshold=4000,
79
- # verbose=True)
80
- ##############
81
- # END CODE #
82
- ##############
83
-
84
- # # generate LLM prompt
85
- # prompt = generate_prompt_series(query=query, results=valid_response)
86
-
87
- # # prep for streaming response
88
- # st.subheader("Response from Impact Theory (context)")
89
- # with st.spinner('Generating Response...'):
90
- # st.markdown("----")
91
- # #creates container for LLM response
92
- # chat_container, response_box = [], st.empty()
93
- #
94
- # # execute chat call to LLM
95
- # ##############
96
- # # START CODE #
97
- # ##############
98
- #
99
-
100
- # ##############
101
- # # END CODE #
102
- # ##############
103
- # try:
104
- #inserts chat stream from LLM
105
- # with response_box:
106
- # content = resp.choices[0].delta.content
107
- # if content:
108
- # chat_container.append(content)
109
- # result = "".join(chat_container).strip()
110
- # st.write(f'{result}')
111
- # except Exception as e:
112
- # print(e)
113
- # continue
114
- # ##############
115
- # # START CODE #
116
- # ##############
117
- # st.subheader("Search Results")
118
- # for i, hit in enumerate(valid_response):
119
- # col1, col2 = st.columns([7, 3], gap='large')
120
- # image = # get thumbnail_url
121
- # episode_url = # get episode_url
122
- # title = # get title
123
- # show_length = # get length
124
- # time_string = # convert show_length to readable time string
125
- # ##############
126
- # # END CODE #
127
- # ##############
128
- # with col1:
129
- # st.write( search_result( i=i,
130
- # url=episode_url,
131
- # guest=hit['guest'],
132
- # title=title,
133
- # content=hit['content'],
134
- # length=time_string),
135
- # unsafe_allow_html=True)
136
- # st.write('\n\n')
137
- # with col2:
138
- # # st.write(f"<a href={episode_url} <img src={image} width='200'></a>",
139
- # # unsafe_allow_html=True)
140
- # st.image(image, caption=title.split('|')[0], width=200, use_column_width=False)
141
-
142
- if __name__ == '__main__':
143
- main()