JohnAlexander23 commited on
Commit
5581d66
·
verified ·
1 Parent(s): c8c0952

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +71 -88
app.py CHANGED
@@ -13,100 +13,83 @@ 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
 
21
  # Streamlit app
22
- def main():
23
- st.set_page_config(
24
- page_title="AI Chatbot",
25
- page_icon=":robot:",
26
- layout="wide", # Remove sidebars
27
- )
28
-
29
- # Custom background with CSS (adjust values for 3D effect)
30
- st.markdown(
31
- """
32
- <style>
33
- body {
34
- background-color: #000;
35
- background-image: linear-gradient(to right, #800080, #4B0082);
36
- animation:
37
- gradient 15s ease-in-out infinite alternate;
38
- }
39
-
40
- @keyframes gradient {
41
- 0% {
42
- background-position: 0% 0%;
43
- }
44
- 100% {
45
- background-position: 100% 0%;
46
- }
47
- }
48
- </style>
49
- """,
50
- unsafe_allow_html=True,
51
- )
52
-
53
- # Define CSS classes
54
- st.write(
55
- """
56
- <style>
57
- .futuristic-title {
58
- font-family: 'VT323'; /* Replace with desired font */
59
- color: #FF007F;
60
- }
61
-
62
- .question-box {
63
- border-radius: 10px;
64
- box-shadow: 0 0 10px #FF007F;
65
- padding: 10px;
66
- }
67
-
68
- .response-button {
69
- background-color: #4B0082;
70
- color: white;
71
- border: none;
72
- padding: 10px 20px;
73
- border-radius: 5px;
74
- cursor: pointer;
75
- box-shadow: 0 0 5px #FF007F;
76
- transition: 0.3s ease;
77
- font-weight: bold;
78
- }
79
-
80
- .response-text {
81
- color: #C71585;
82
- font-size: 1.2em;
83
- margin-top: 20px;
84
- }
85
- </style>
86
- """,
87
- unsafe_allow_html=True,
88
- )
89
-
90
- # Title with futuristic font and color using class (updated keyword)
91
- st.title("AI Assistant", class_="futuristic-title")
92
-
93
- # Question box with rounded corners and glowing effect (class applied)
94
- user_question = st.text_area(
95
- "Ask your question...", height=100, class_="question-box"
96
- )
97
-
98
- # Button with hover effect (class applied)
99
- if st.button("Get Response", class_="response-button"):
100
- response = fetch_response(user_question)
101
- st.write("<div class='response-text'>", unsafe_allow_html=True)
102
- st.write("Response:", response)
103
- st.write("</div>", unsafe_allow_html=True) # Added the missing closing tag
104
-
105
- # Response box with a different color (class applied)
106
-
107
 
108
- if __name__ == "__main__":
109
- main()
110
 
111
 
112
 
 
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
+ # Set page config
21
+ st.set_page_config(
22
+ page_title="CyberChat",
23
+ page_icon="🤖",
24
+ layout="wide",
25
+ initial_sidebar_state="expanded"
26
+ )
27
+
28
+ # Cyberpunk style CSS
29
+ cyberpunk_style = """
30
+ <style>
31
+ body {
32
+ color: #8AFF80;
33
+ background-color: #0D0D0D;
34
+ }
35
+
36
+ .stButton>button {
37
+ color: #8AFF80 !important;
38
+ background-color: #0D0D0D !important;
39
+ border-color: #8AFF80 !important;
40
+ font-family: 'Orbitron', sans-serif;
41
+ border-radius: 20px;
42
+ }
43
+
44
+ .stTextInput>div>div>input {
45
+ color: #8AFF80 !important;
46
+ background-color: #0D0D0D !important;
47
+ border-color: #8AFF80 !important;
48
+ font-family: 'Orbitron', sans-serif;
49
+ }
50
+
51
+ .stTextInput>div>div>input::placeholder {
52
+ color: #8AFF80 !important;
53
+ }
54
+
55
+ .stTextInput>div>div>input:focus {
56
+ border-color: #8AFF80 !important;
57
+ box-shadow: 0 0 0 0.2rem rgba(138, 255, 163, 0.5) !important;
58
+ }
59
+
60
+ footer {
61
+ color: #8AFF80;
62
+ font-size: small;
63
+ text-align: right;
64
+ font-family: 'Orbitron', sans-serif;
65
+ }
66
+ </style>
67
+ """
68
 
69
  # Streamlit app
70
+ st.markdown(cyberpunk_style, unsafe_allow_html=True)
71
+ st.title("CyberChat")
72
+ st.subheader("Ask a question and get a response.")
73
+
74
+ # Text input for user's question
75
+ user_input = st.text_input("Enter your question here:")
76
+
77
+ # Button to trigger response
78
+ if st.button("Get Response"):
79
+ # Fetch and display response
80
+ response = fetch_response(user_input)
81
+ st.write("Response:", response)
82
+
83
+ # Footer
84
+ st.markdown(
85
+ """
86
+ <footer>
87
+ By DL Titans
88
+ </footer>
89
+ """,
90
+ unsafe_allow_html=True
91
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
 
 
93
 
94
 
95