Ubuntu
commited on
Commit
·
dc7ac95
1
Parent(s):
5b2a0f1
fixed UI issues
Browse files
app.py
CHANGED
@@ -22,6 +22,7 @@ st.markdown("""
|
|
22 |
margin-left: auto;
|
23 |
margin-right: 10px;
|
24 |
position: relative;
|
|
|
25 |
}
|
26 |
.assistant-bubble {
|
27 |
background-color: #f0f0f0;
|
@@ -31,6 +32,7 @@ st.markdown("""
|
|
31 |
max-width: 80%;
|
32 |
margin-left: 10px;
|
33 |
position: relative;
|
|
|
34 |
}
|
35 |
.chat-container {
|
36 |
display: flex;
|
@@ -47,6 +49,22 @@ st.markdown("""
|
|
47 |
border-radius: 20px;
|
48 |
width: 100%;
|
49 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
</style>
|
51 |
""", unsafe_allow_html=True)
|
52 |
|
@@ -57,8 +75,8 @@ if "messages" not in st.session_state:
|
|
57 |
if "model_loaded" not in st.session_state:
|
58 |
st.session_state.model_loaded = False
|
59 |
|
60 |
-
# App title
|
61 |
-
st.
|
62 |
|
63 |
# Load model (only once)
|
64 |
if not st.session_state.model_loaded:
|
@@ -83,7 +101,11 @@ st.markdown('</div>', unsafe_allow_html=True)
|
|
83 |
|
84 |
# Chat input
|
85 |
with st.container():
|
86 |
-
|
|
|
|
|
|
|
|
|
87 |
|
88 |
# Process input when user submits a message
|
89 |
if user_input:
|
@@ -121,7 +143,7 @@ with st.container():
|
|
121 |
# Rerun to update the UI
|
122 |
st.experimental_rerun()
|
123 |
|
124 |
-
#
|
125 |
-
if
|
126 |
st.session_state.messages = []
|
127 |
st.experimental_rerun()
|
|
|
22 |
margin-left: auto;
|
23 |
margin-right: 10px;
|
24 |
position: relative;
|
25 |
+
color: #000000; /* Ensure text is black */
|
26 |
}
|
27 |
.assistant-bubble {
|
28 |
background-color: #f0f0f0;
|
|
|
32 |
max-width: 80%;
|
33 |
margin-left: 10px;
|
34 |
position: relative;
|
35 |
+
color: #000000; /* Ensure text is black */
|
36 |
}
|
37 |
.chat-container {
|
38 |
display: flex;
|
|
|
49 |
border-radius: 20px;
|
50 |
width: 100%;
|
51 |
}
|
52 |
+
/* Fix for excessive vertical space */
|
53 |
+
header {
|
54 |
+
visibility: hidden;
|
55 |
+
}
|
56 |
+
.block-container {
|
57 |
+
padding-top: 1rem;
|
58 |
+
padding-bottom: 1rem;
|
59 |
+
}
|
60 |
+
h1 {
|
61 |
+
margin-top: 0 !important;
|
62 |
+
margin-bottom: 1rem !important;
|
63 |
+
}
|
64 |
+
/* Ensure dark mode compatibility */
|
65 |
+
.stApp {
|
66 |
+
background-color: #121212;
|
67 |
+
}
|
68 |
</style>
|
69 |
""", unsafe_allow_html=True)
|
70 |
|
|
|
75 |
if "model_loaded" not in st.session_state:
|
76 |
st.session_state.model_loaded = False
|
77 |
|
78 |
+
# App title - made smaller to reduce vertical space
|
79 |
+
st.markdown("<h2>Phi-2 Fine-tuned Assistant</h2>", unsafe_allow_html=True)
|
80 |
|
81 |
# Load model (only once)
|
82 |
if not st.session_state.model_loaded:
|
|
|
101 |
|
102 |
# Chat input
|
103 |
with st.container():
|
104 |
+
col1, col2 = st.columns([5, 1])
|
105 |
+
with col1:
|
106 |
+
user_input = st.text_input("", key="user_input", placeholder="Type your message here...")
|
107 |
+
with col2:
|
108 |
+
clear_button = st.button("Clear")
|
109 |
|
110 |
# Process input when user submits a message
|
111 |
if user_input:
|
|
|
143 |
# Rerun to update the UI
|
144 |
st.experimental_rerun()
|
145 |
|
146 |
+
# Clear chat when button is pressed
|
147 |
+
if clear_button:
|
148 |
st.session_state.messages = []
|
149 |
st.experimental_rerun()
|