eagle0504 commited on
Commit
6e06b59
Β·
verified Β·
1 Parent(s): 2793118

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -3,8 +3,11 @@ import os
3
  from helper import invoke_text_api, invoke_text_image_api
4
  import base64
5
 
 
 
 
6
  # App Title with Emoji
7
- st.title("πŸ€– ChatBot with Image Support πŸ–ΌοΈ")
8
 
9
  # Sidebar for Image Upload
10
  st.sidebar.header("πŸ“‚ Upload an Image (Optional)")
@@ -12,7 +15,7 @@ uploaded_file = st.sidebar.file_uploader("πŸ“Έ Upload an image", type=["png", "j
12
 
13
  # If an image is uploaded, display it in the sidebar
14
  if uploaded_file:
15
- st.sidebar.image(uploaded_file, caption="πŸ–ΌοΈ Uploaded Image Preview", use_column_width=True)
16
 
17
  # Sidebar Parameters for AI Model
18
  st.sidebar.header("βš™οΈ Model Parameters")
@@ -25,7 +28,7 @@ top_p = st.sidebar.slider("πŸ“Š Top P (Probability Sampling)", 0.0, 1.0, 0.98)
25
  # Button to clear chat history
26
  if st.sidebar.button("πŸ—‘οΈ Clear Chat History"):
27
  st.session_state.messages = [] # Reset conversation history
28
- st.rerun() # Refresh the app
29
 
30
  # Initialize chat history
31
  if "messages" not in st.session_state:
 
3
  from helper import invoke_text_api, invoke_text_image_api
4
  import base64
5
 
6
+ # Set Streamlit page config to wide layout
7
+ st.set_page_config(page_title="Chatbot", layout="wide")
8
+
9
  # App Title with Emoji
10
+ st.title("πŸ€– Chatbot with Image Support πŸ–ΌοΈ")
11
 
12
  # Sidebar for Image Upload
13
  st.sidebar.header("πŸ“‚ Upload an Image (Optional)")
 
15
 
16
  # If an image is uploaded, display it in the sidebar
17
  if uploaded_file:
18
+ st.sidebar.image(uploaded_file, caption="πŸ–ΌοΈ Uploaded Image Preview", use_container_width=True)
19
 
20
  # Sidebar Parameters for AI Model
21
  st.sidebar.header("βš™οΈ Model Parameters")
 
28
  # Button to clear chat history
29
  if st.sidebar.button("πŸ—‘οΈ Clear Chat History"):
30
  st.session_state.messages = [] # Reset conversation history
31
+ st.rerun() # Corrected method to refresh the app
32
 
33
  # Initialize chat history
34
  if "messages" not in st.session_state: