Nyanfa commited on
Commit
df388cb
·
verified ·
1 Parent(s): 4f4cd9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -14
app.py CHANGED
@@ -28,19 +28,7 @@ if "messages" not in st.session_state:
28
 
29
  def get_ai_response(prompt, chat_history):
30
  st.session_state.is_streaming = True
31
-
32
- with stylable_container(
33
- key="stop_generating",
34
- css_styles="""
35
- button {
36
- position: fixed;
37
- bottom: 100px;
38
- left: 50%;
39
- transform: translateX(-50%);
40
- }
41
- """,
42
- ):
43
- st.button("Stop generating")
44
 
45
  with st.chat_message("ai"):
46
  penalty_kwargs = {
@@ -58,8 +46,22 @@ def get_ai_response(prompt, chat_history):
58
  **penalty_kwargs
59
  )
60
 
61
- st.session_state.response = ""
62
  placeholder = st.empty()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  for event in stream:
64
  if event.event_type == "text-generation":
65
  content = event.text
 
28
 
29
  def get_ai_response(prompt, chat_history):
30
  st.session_state.is_streaming = True
31
+ st.session_state.response = ""
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  with st.chat_message("ai"):
34
  penalty_kwargs = {
 
46
  **penalty_kwargs
47
  )
48
 
 
49
  placeholder = st.empty()
50
+
51
+ with stylable_container(
52
+ key="stop_generating",
53
+ css_styles="""
54
+ button {
55
+ position: fixed;
56
+ bottom: 100px;
57
+ left: 50%;
58
+ transform: translateX(-50%);
59
+ z-index: 1;
60
+ }
61
+ """,
62
+ ):
63
+ st.button("Stop generating")
64
+
65
  for event in stream:
66
  if event.event_type == "text-generation":
67
  content = event.text