awacke1 commited on
Commit
353974f
·
1 Parent(s): cdf47fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -110,11 +110,14 @@ def read_file_content(file,max_length):
110
 
111
  def main():
112
  user_prompt = st.text_area("Your question:", '', height=120)
113
- uploaded_file = st.file_uploader("Choose a file", type=["xml", "json", "html", "htm", "md", "txt"])
114
- #max_length = 4000
115
-
116
- max_length = st.sidebar.slider("Max Context Section Length", min_value=1000, max_value=32000, value=4000, step=1000)
117
 
 
 
 
 
 
 
 
118
  document_sections = deque()
119
  document_responses = {}
120
 
@@ -124,10 +127,10 @@ def main():
124
 
125
  if len(document_sections) > 0:
126
 
127
- st.markdown("**Sections of the uploaded file:**")
128
- for i, section in enumerate(list(document_sections)):
129
- st.markdown(f"**Section {i+1}**\n{section}")
130
-
131
 
132
  st.markdown("**Chat with the model:**")
133
  for i, section in enumerate(list(document_sections)):
 
110
 
111
  def main():
112
  user_prompt = st.text_area("Your question:", '', height=120)
 
 
 
 
113
 
114
+ collength, colupload = st.sidebar.columns([4,1]) # adjust the ratio as needed
115
+ with collength:
116
+ #max_length = 12000 - optimal for gpt35 turbo. 2x=24000 for gpt4. 8x=96000 for gpt4-32k.
117
+ max_length = st.slider("Context Section Length", min_value=1000, max_value=128000, value=12000, step=1000)
118
+ with colupload:
119
+ uploaded_file = st.file_uploader("Choose a file", type=["xml", "json", "html", "htm", "md", "txt"])
120
+
121
  document_sections = deque()
122
  document_responses = {}
123
 
 
127
 
128
  if len(document_sections) > 0:
129
 
130
+ if st.button("👁️ View Upload"):
131
+ st.markdown("**Sections of the uploaded file:**")
132
+ for i, section in enumerate(list(document_sections)):
133
+ st.markdown(f"**Section {i+1}**\n{section}")
134
 
135
  st.markdown("**Chat with the model:**")
136
  for i, section in enumerate(list(document_sections)):