Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,8 @@ import os
|
|
5 |
import streamlit as st
|
6 |
from PIL import Image
|
7 |
|
|
|
|
|
8 |
|
9 |
def launch_bot():
|
10 |
def generate_response(question):
|
@@ -24,7 +26,7 @@ def launch_bot():
|
|
24 |
'title': os.environ['title'],
|
25 |
'description': os.environ['description'],
|
26 |
'source_data_desc': os.environ['source_data_desc'],
|
27 |
-
'streaming': os.environ.get('streaming', False),
|
28 |
'prompt_name': os.environ.get('prompt_name', None)
|
29 |
})
|
30 |
st.session_state.cfg = cfg
|
@@ -68,7 +70,6 @@ def launch_bot():
|
|
68 |
st.write(prompt)
|
69 |
|
70 |
# Generate a new response if last message is not from assistant
|
71 |
-
print(f"DEBUG streaming = {cfg.streaming}, type={type(cfg.streaming)}")
|
72 |
if st.session_state.messages[-1]["role"] != "assistant":
|
73 |
with st.chat_message("assistant"):
|
74 |
if cfg.streaming:
|
|
|
5 |
import streamlit as st
|
6 |
from PIL import Image
|
7 |
|
8 |
+
def isTrue(s: str) -> bool:
|
9 |
+
return s.trim().lower() == 'true'
|
10 |
|
11 |
def launch_bot():
|
12 |
def generate_response(question):
|
|
|
26 |
'title': os.environ['title'],
|
27 |
'description': os.environ['description'],
|
28 |
'source_data_desc': os.environ['source_data_desc'],
|
29 |
+
'streaming': isTrue(os.environ.get('streaming', False)),
|
30 |
'prompt_name': os.environ.get('prompt_name', None)
|
31 |
})
|
32 |
st.session_state.cfg = cfg
|
|
|
70 |
st.write(prompt)
|
71 |
|
72 |
# Generate a new response if last message is not from assistant
|
|
|
73 |
if st.session_state.messages[-1]["role"] != "assistant":
|
74 |
with st.chat_message("assistant"):
|
75 |
if cfg.streaming:
|