Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,51 +17,6 @@ if 'API_Key' not in st.session_state:
|
|
17 |
|
18 |
# Step 3: Build the Streamlit UI
|
19 |
st.set_page_config(page_title="Chat GPT Clone", page_icon=":robot_face:")
|
20 |
-
|
21 |
-
# Custom CSS to center the conversation and responses
|
22 |
-
st.markdown("""
|
23 |
-
<style>
|
24 |
-
.main-container {
|
25 |
-
display: flex;
|
26 |
-
justify-content: center;
|
27 |
-
align-items: center;
|
28 |
-
text-align: center;
|
29 |
-
flex-direction: column;
|
30 |
-
width: 100%;
|
31 |
-
}
|
32 |
-
.chat-container {
|
33 |
-
max-width: 800px;
|
34 |
-
width: 100%;
|
35 |
-
padding: 20px;
|
36 |
-
border-radius: 8px;
|
37 |
-
background-color: #2f2f2f;
|
38 |
-
color: white;
|
39 |
-
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
|
40 |
-
margin-top: 20px;
|
41 |
-
}
|
42 |
-
.message-container {
|
43 |
-
display: flex;
|
44 |
-
flex-direction: column;
|
45 |
-
gap: 10px;
|
46 |
-
}
|
47 |
-
.message {
|
48 |
-
padding: 10px;
|
49 |
-
border-radius: 5px;
|
50 |
-
margin: 5px;
|
51 |
-
max-width: 70%;
|
52 |
-
}
|
53 |
-
.user-message {
|
54 |
-
background-color: #4a90e2;
|
55 |
-
align-self: flex-start;
|
56 |
-
}
|
57 |
-
.ai-message {
|
58 |
-
background-color: #444;
|
59 |
-
align-self: flex-start;
|
60 |
-
margin-left: 15%;
|
61 |
-
}
|
62 |
-
</style>
|
63 |
-
""", unsafe_allow_html=True)
|
64 |
-
|
65 |
st.markdown("<h1 style='text-align: center;'>How can I assist you? </h1>", unsafe_allow_html=True)
|
66 |
|
67 |
# Sidebar for API key input
|
@@ -106,15 +61,8 @@ with container:
|
|
106 |
st.session_state['messages'].append(model_response)
|
107 |
|
108 |
with response_container:
|
109 |
-
# Wrapping the chat in a container to center it
|
110 |
-
st.markdown('<div class="main-container">', unsafe_allow_html=True)
|
111 |
-
st.markdown('<div class="chat-container">', unsafe_allow_html=True)
|
112 |
-
|
113 |
-
# Display the conversation
|
114 |
for i in range(len(st.session_state['messages'])):
|
115 |
if (i % 2) == 0:
|
116 |
-
message(st.session_state['messages'][i], is_user=True, key=str(i) + '_user'
|
117 |
else:
|
118 |
-
message(st.session_state['messages'][i], key=str(i) + '_AI'
|
119 |
-
|
120 |
-
st.markdown('</div></div>', unsafe_allow_html=True)
|
|
|
17 |
|
18 |
# Step 3: Build the Streamlit UI
|
19 |
st.set_page_config(page_title="Chat GPT Clone", page_icon=":robot_face:")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
st.markdown("<h1 style='text-align: center;'>How can I assist you? </h1>", unsafe_allow_html=True)
|
21 |
|
22 |
# Sidebar for API key input
|
|
|
61 |
st.session_state['messages'].append(model_response)
|
62 |
|
63 |
with response_container:
|
|
|
|
|
|
|
|
|
|
|
64 |
for i in range(len(st.session_state['messages'])):
|
65 |
if (i % 2) == 0:
|
66 |
+
message(st.session_state['messages'][i], is_user=True, key=str(i) + '_user')
|
67 |
else:
|
68 |
+
message(st.session_state['messages'][i], key=str(i) + '_AI')
|
|
|
|