awacke1 commited on
Commit
988a5cb
·
1 Parent(s): 918df56

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +52 -3
app.py CHANGED
@@ -11,10 +11,60 @@ from datetime import datetime
11
  from openai import ChatCompletion
12
  from xml.etree import ElementTree as ET
13
  from bs4 import BeautifulSoup
 
14
 
15
  openai.api_key = os.getenv('OPENAI_KEY')
16
- st.set_page_config(page_title='Streamlit ChatGPT Document Reasoner', layout='wide')
17
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  def chat_with_model(prompts):
19
  model = "gpt-3.5-turbo"
20
  #model = "gpt-4-32k" # 32k tokens between prompt and inference tokens
@@ -92,7 +142,6 @@ def read_file_content(file):
92
  return ""
93
 
94
  def main():
95
- st.title("Chat with AI")
96
 
97
  prompts = ['']
98
  file_content = ""
 
11
  from openai import ChatCompletion
12
  from xml.etree import ElementTree as ET
13
  from bs4 import BeautifulSoup
14
+ from streamlit.theme import Theme
15
 
16
  openai.api_key = os.getenv('OPENAI_KEY')
17
+ #st.set_page_config(page_title='GPT Streamlit Document Reasoner', layout='wide')
18
+
19
+ st.set_page_config(
20
+ page_title="GPT Streamlit Document Reasoner",
21
+ layout="wide",
22
+ theme=Theme(
23
+ primary_color="#F63366",
24
+ secondary_background_color="#F0F2F6",
25
+ text_color="#262730",
26
+ font="sans serif",
27
+ ),
28
+ )
29
+ st.title("Chat with AI")
30
+
31
+ # Create a sidebar with menus
32
+ st.sidebar.title("Menu")
33
+ menu = ["Option 1", "Option 2", "Option 3"]
34
+ choice = st.sidebar.selectbox("Choose an option", menu)
35
+
36
+ if choice == "Option 1":
37
+ st.sidebar.write("You selected Option 1")
38
+ elif choice == "Option 2":
39
+ st.sidebar.write("You selected Option 2")
40
+ elif choice == "Option 3":
41
+ st.sidebar.write("You selected Option 3")
42
+
43
+ # Create a slider in the sidebar
44
+ max_length = st.sidebar.slider(
45
+ "Max document length", min_value=3000, max_value=24000, value=3000, step=1000
46
+ )
47
+
48
+ # Truncate document
49
+ def truncate_document(document, length):
50
+ return document[:length]
51
+
52
+ # Assume you have a document called my_document
53
+ # my_document = 'your long string here'
54
+ # truncated_document = truncate_document(my_document, max_length)
55
+ # st.write(f"Truncated document: {truncated_document}")
56
+
57
+ # Create two tabs
58
+ tab = st.selectbox("Choose a tab", ["Tab 1", "Tab 2"])
59
+
60
+ if tab == "Tab 1":
61
+ st.header("Tab 1")
62
+ st.write("This is some information for Tab 1")
63
+
64
+ elif tab == "Tab 2":
65
+ st.header("Tab 2")
66
+ st.write("This is some information for Tab 2")
67
+
68
  def chat_with_model(prompts):
69
  model = "gpt-3.5-turbo"
70
  #model = "gpt-4-32k" # 32k tokens between prompt and inference tokens
 
142
  return ""
143
 
144
  def main():
 
145
 
146
  prompts = ['']
147
  file_content = ""