Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import pickle
|
|
| 4 |
import time
|
| 5 |
import requests
|
| 6 |
|
| 7 |
-
st.set_page_config(page_title="
|
| 8 |
|
| 9 |
st.markdown(
|
| 10 |
"""
|
|
@@ -87,7 +87,7 @@ def main_app():
|
|
| 87 |
"chat_history": []
|
| 88 |
|
| 89 |
}
|
| 90 |
-
response = requests.post('http://
|
| 91 |
|
| 92 |
return response.json()
|
| 93 |
|
|
@@ -100,7 +100,11 @@ def main_app():
|
|
| 100 |
with st.spinner("Thinking..."):
|
| 101 |
response = generate_response(prompt)
|
| 102 |
st.markdown(response['response'])
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
save_conversations(st.session_state.conversations)
|
| 105 |
|
| 106 |
|
|
|
|
| 4 |
import time
|
| 5 |
import requests
|
| 6 |
|
| 7 |
+
st.set_page_config(page_title="Psychedelics GPT")
|
| 8 |
|
| 9 |
st.markdown(
|
| 10 |
"""
|
|
|
|
| 87 |
"chat_history": []
|
| 88 |
|
| 89 |
}
|
| 90 |
+
response = requests.post('http://3.223.163.181:8090/generate', json=json)
|
| 91 |
|
| 92 |
return response.json()
|
| 93 |
|
|
|
|
| 100 |
with st.spinner("Thinking..."):
|
| 101 |
response = generate_response(prompt)
|
| 102 |
st.markdown(response['response'])
|
| 103 |
+
sources_str = 'References:\n' + '\n'.join(
|
| 104 |
+
[f'{idx + 1}. {source}' for idx, source in enumerate(response['sources'])])
|
| 105 |
+
st.markdown(sources_str)
|
| 106 |
+
st.session_state.current_conversation.append(
|
| 107 |
+
{"role": "assistant", "content": response['response'] + "\n" + sources_str})
|
| 108 |
save_conversations(st.session_state.conversations)
|
| 109 |
|
| 110 |
|