Spaces:
Running
Running
Update app.py
Browse files
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("π€
|
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",
|
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() #
|
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:
|