Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -94,7 +94,7 @@ def read_file_content(file):
|
|
94 |
return ""
|
95 |
|
96 |
def main():
|
97 |
-
col1, col2
|
98 |
|
99 |
with col1:
|
100 |
user_prompt = st.text_area("Your question:", '', height=120)
|
@@ -109,27 +109,21 @@ def main():
|
|
109 |
|
110 |
if len(document_sections) > 0:
|
111 |
with col2:
|
112 |
-
st.markdown("**Sections of the uploaded file:**")
|
113 |
-
for i, section in enumerate(list(document_sections)):
|
114 |
-
st.markdown(f"**Section {i+1}**\n{section}")
|
115 |
-
|
116 |
st.markdown("**Chat with the model:**")
|
117 |
for i, section in enumerate(list(document_sections)):
|
118 |
if i in document_responses:
|
119 |
-
st.markdown(f"**Section {i+1}
|
|
|
120 |
else:
|
121 |
if st.button(f"Chat about Section {i+1}"):
|
122 |
st.write('Thinking and Reasoning with your inputs...')
|
123 |
response = chat_with_model(user_prompt, section)
|
124 |
document_responses[i] = response
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
filename = generate_filename(f"{user_prompt}_section_{i+1}", choice)
|
131 |
-
create_file(filename, user_prompt, response)
|
132 |
-
st.sidebar.markdown(get_table_download_link(filename), unsafe_allow_html=True)
|
133 |
|
134 |
if st.button('💬 Chat'):
|
135 |
st.write('Thinking and Reasoning with your inputs...')
|
@@ -152,4 +146,4 @@ def main():
|
|
152 |
st.experimental_rerun()
|
153 |
|
154 |
if __name__ == "__main__":
|
155 |
-
main()
|
|
|
94 |
return ""
|
95 |
|
96 |
def main():
|
97 |
+
col1, col2 = st.columns([1, 2])
|
98 |
|
99 |
with col1:
|
100 |
user_prompt = st.text_area("Your question:", '', height=120)
|
|
|
109 |
|
110 |
if len(document_sections) > 0:
|
111 |
with col2:
|
|
|
|
|
|
|
|
|
112 |
st.markdown("**Chat with the model:**")
|
113 |
for i, section in enumerate(list(document_sections)):
|
114 |
if i in document_responses:
|
115 |
+
st.markdown(f"**Section {i+1} Response:**\n{document_responses[i]}")
|
116 |
+
st.markdown(f"**Section {i+1} Content:**\n{section}")
|
117 |
else:
|
118 |
if st.button(f"Chat about Section {i+1}"):
|
119 |
st.write('Thinking and Reasoning with your inputs...')
|
120 |
response = chat_with_model(user_prompt, section)
|
121 |
document_responses[i] = response
|
122 |
+
st.markdown(f"**Section {i+1} Response:**\n{response}")
|
123 |
+
st.markdown(f"**Section {i+1} Content:**\n{section}")
|
124 |
+
filename = generate_filename(f"{user_prompt}_section_{i+1}", choice)
|
125 |
+
create_file(filename, user_prompt, response)
|
126 |
+
st.sidebar.markdown(get_table_download_link(filename), unsafe_allow_html=True)
|
|
|
|
|
|
|
127 |
|
128 |
if st.button('💬 Chat'):
|
129 |
st.write('Thinking and Reasoning with your inputs...')
|
|
|
146 |
st.experimental_rerun()
|
147 |
|
148 |
if __name__ == "__main__":
|
149 |
+
main()
|