Spaces:
Sleeping
Sleeping
JohnAlexander23
commited on
Commit
•
79d880e
1
Parent(s):
3ed2145
Update app.py
Browse files
app.py
CHANGED
@@ -13,30 +13,61 @@ def fetch_response(user_input):
|
|
13 |
{"role": "user", "content": user_input},
|
14 |
],
|
15 |
model="mixtral-8x7b-32768",
|
16 |
-
stream=False
|
17 |
)
|
18 |
return chat_completion.choices[0].message.content
|
19 |
|
|
|
20 |
# Streamlit app
|
21 |
-
st.
|
22 |
-
|
23 |
-
|
24 |
-
#
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
|
|
13 |
{"role": "user", "content": user_input},
|
14 |
],
|
15 |
model="mixtral-8x7b-32768",
|
16 |
+
stream=False,
|
17 |
)
|
18 |
return chat_completion.choices[0].message.content
|
19 |
|
20 |
+
|
21 |
# Streamlit app
|
22 |
+
st.set_page_config(page_title="AI Chatbot", page_icon=":robot:") # Set app title and icon
|
23 |
+
|
24 |
+
def main():
|
25 |
+
# Layout with sidebar
|
26 |
+
col1, col2 = st.beta_columns([3, 1])
|
27 |
+
|
28 |
+
with col1:
|
29 |
+
# Header with logo (replace with custom logo CSS)
|
30 |
+
st.markdown(
|
31 |
+
"""
|
32 |
+
<h1 style="font-size: 2.5em; color: #3b5998">
|
33 |
+
<span style="font-weight: bold;">AI</span> Chatbot
|
34 |
+
</h1>
|
35 |
+
""",
|
36 |
+
unsafe_allow_html=True,
|
37 |
+
)
|
38 |
+
|
39 |
+
# Search bar (style as needed)
|
40 |
+
with st.expander("Search", expanded=False):
|
41 |
+
st.text_input("Search here...", key="search")
|
42 |
+
|
43 |
+
# Question box
|
44 |
+
user_question = st.text_area("Ask a question...", height=100)
|
45 |
+
|
46 |
+
# Button to trigger response
|
47 |
+
if st.button("Get Response"):
|
48 |
+
response = fetch_response(user_question)
|
49 |
+
st.write("Response:", response)
|
50 |
+
|
51 |
+
with col2:
|
52 |
+
# Sidebar header
|
53 |
+
st.sidebar.header("Navigation")
|
54 |
+
|
55 |
+
# Navigation buttons (style as needed)
|
56 |
+
st.sidebar.button("Home", key="home")
|
57 |
+
st.sidebar.button("Profile", key="profile")
|
58 |
+
st.sidebar.button("Settings", key="settings")
|
59 |
+
|
60 |
+
# Footer
|
61 |
+
st.markdown(
|
62 |
+
"""
|
63 |
+
<footer style="color: #3b5998; text-align: right;">
|
64 |
+
<p>By DL Titans</p>
|
65 |
+
</footer>
|
66 |
+
""",
|
67 |
+
unsafe_allow_html=True,
|
68 |
+
)
|
69 |
+
|
70 |
+
|
71 |
+
if __name__ == "__main__":
|
72 |
+
main()
|
73 |
|