Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import openai
|
|
|
|
| 3 |
|
| 4 |
# Set OpenAI API Key
|
| 5 |
-
openai.api_key = "
|
| 6 |
openai.api_base = "https://api.groq.com/openai/v1"
|
| 7 |
|
| 8 |
# Dictionary to store categorized chats
|
|
@@ -70,13 +71,11 @@ body {
|
|
| 70 |
padding: 0;
|
| 71 |
color: #333;
|
| 72 |
}
|
| 73 |
-
|
| 74 |
@keyframes gradientBG {
|
| 75 |
0% { background-position: 0% 50%; }
|
| 76 |
50% { background-position: 100% 50%; }
|
| 77 |
100% { background-position: 0% 50%; }
|
| 78 |
}
|
| 79 |
-
|
| 80 |
header, footer {
|
| 81 |
text-align: center;
|
| 82 |
background: linear-gradient(90deg, #ff758c, #ff7eb3);
|
|
@@ -86,7 +85,6 @@ header, footer {
|
|
| 86 |
margin-bottom: 1rem;
|
| 87 |
box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.2);
|
| 88 |
}
|
| 89 |
-
|
| 90 |
.chatbot-container {
|
| 91 |
display: flex;
|
| 92 |
flex-direction: column;
|
|
@@ -98,7 +96,6 @@ header, footer {
|
|
| 98 |
overflow-y: auto;
|
| 99 |
box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.2);
|
| 100 |
}
|
| 101 |
-
|
| 102 |
input, button {
|
| 103 |
border: none;
|
| 104 |
padding: 0.8rem;
|
|
@@ -106,13 +103,11 @@ input, button {
|
|
| 106 |
margin: 0.5rem 0;
|
| 107 |
outline: none;
|
| 108 |
}
|
| 109 |
-
|
| 110 |
input {
|
| 111 |
background: #fff;
|
| 112 |
-
color: #
|
| 113 |
font-size: 1rem;
|
| 114 |
}
|
| 115 |
-
|
| 116 |
button {
|
| 117 |
background: linear-gradient(90deg, #6a11cb, #2575fc);
|
| 118 |
color: white;
|
|
@@ -120,12 +115,10 @@ button {
|
|
| 120 |
cursor: pointer;
|
| 121 |
transition: transform 0.2s, background 0.2s;
|
| 122 |
}
|
| 123 |
-
|
| 124 |
button:hover {
|
| 125 |
transform: scale(1.05);
|
| 126 |
background: linear-gradient(90deg, #2575fc, #6a11cb);
|
| 127 |
}
|
| 128 |
-
|
| 129 |
.chat-category {
|
| 130 |
background: rgba(0, 0, 0, 0.05);
|
| 131 |
border: 2px solid #ff7eb3;
|
|
@@ -134,7 +127,6 @@ button:hover {
|
|
| 134 |
border-radius: 10px;
|
| 135 |
transition: transform 0.2s, box-shadow 0.2s;
|
| 136 |
}
|
| 137 |
-
|
| 138 |
.chat-category:hover {
|
| 139 |
transform: translateY(-3px);
|
| 140 |
box-shadow: 0px 4px 15px rgba(255, 127, 179, 0.5);
|
|
@@ -145,7 +137,7 @@ with chat_interface:
|
|
| 145 |
with gr.Row():
|
| 146 |
gr.Markdown("<h1 style='text-align:center;'>🌈 Vibrant Motivational Chatbot</h1>")
|
| 147 |
with gr.Row():
|
| 148 |
-
gr.Markdown("
|
| 149 |
with gr.Row():
|
| 150 |
chatbot_output = gr.Chatbot(label="Motivator Bot")
|
| 151 |
with gr.Row():
|
|
@@ -164,5 +156,5 @@ with chat_interface:
|
|
| 164 |
send_button.click(handle_interaction, inputs=[user_input, chatbot_output], outputs=[chatbot_output, saved_chats_display])
|
| 165 |
refresh_button.click(display_saved_chats, inputs=[], outputs=saved_chats_display)
|
| 166 |
|
| 167 |
-
if
|
| 168 |
chat_interface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import openai
|
| 3 |
+
import os
|
| 4 |
|
| 5 |
# Set OpenAI API Key
|
| 6 |
+
openai.api_key = os.getenv("GROQ_API_KEY")
|
| 7 |
openai.api_base = "https://api.groq.com/openai/v1"
|
| 8 |
|
| 9 |
# Dictionary to store categorized chats
|
|
|
|
| 71 |
padding: 0;
|
| 72 |
color: #333;
|
| 73 |
}
|
|
|
|
| 74 |
@keyframes gradientBG {
|
| 75 |
0% { background-position: 0% 50%; }
|
| 76 |
50% { background-position: 100% 50%; }
|
| 77 |
100% { background-position: 0% 50%; }
|
| 78 |
}
|
|
|
|
| 79 |
header, footer {
|
| 80 |
text-align: center;
|
| 81 |
background: linear-gradient(90deg, #ff758c, #ff7eb3);
|
|
|
|
| 85 |
margin-bottom: 1rem;
|
| 86 |
box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.2);
|
| 87 |
}
|
|
|
|
| 88 |
.chatbot-container {
|
| 89 |
display: flex;
|
| 90 |
flex-direction: column;
|
|
|
|
| 96 |
overflow-y: auto;
|
| 97 |
box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.2);
|
| 98 |
}
|
|
|
|
| 99 |
input, button {
|
| 100 |
border: none;
|
| 101 |
padding: 0.8rem;
|
|
|
|
| 103 |
margin: 0.5rem 0;
|
| 104 |
outline: none;
|
| 105 |
}
|
|
|
|
| 106 |
input {
|
| 107 |
background: #fff;
|
| 108 |
+
color: #ffffff;
|
| 109 |
font-size: 1rem;
|
| 110 |
}
|
|
|
|
| 111 |
button {
|
| 112 |
background: linear-gradient(90deg, #6a11cb, #2575fc);
|
| 113 |
color: white;
|
|
|
|
| 115 |
cursor: pointer;
|
| 116 |
transition: transform 0.2s, background 0.2s;
|
| 117 |
}
|
|
|
|
| 118 |
button:hover {
|
| 119 |
transform: scale(1.05);
|
| 120 |
background: linear-gradient(90deg, #2575fc, #6a11cb);
|
| 121 |
}
|
|
|
|
| 122 |
.chat-category {
|
| 123 |
background: rgba(0, 0, 0, 0.05);
|
| 124 |
border: 2px solid #ff7eb3;
|
|
|
|
| 127 |
border-radius: 10px;
|
| 128 |
transition: transform 0.2s, box-shadow 0.2s;
|
| 129 |
}
|
|
|
|
| 130 |
.chat-category:hover {
|
| 131 |
transform: translateY(-3px);
|
| 132 |
box-shadow: 0px 4px 15px rgba(255, 127, 179, 0.5);
|
|
|
|
| 137 |
with gr.Row():
|
| 138 |
gr.Markdown("<h1 style='text-align:center;'>🌈 Vibrant Motivational Chatbot</h1>")
|
| 139 |
with gr.Row():
|
| 140 |
+
gr.Markdown("**Feeling stressed or unmotivated? Share your thoughts and let me help!**")
|
| 141 |
with gr.Row():
|
| 142 |
chatbot_output = gr.Chatbot(label="Motivator Bot")
|
| 143 |
with gr.Row():
|
|
|
|
| 156 |
send_button.click(handle_interaction, inputs=[user_input, chatbot_output], outputs=[chatbot_output, saved_chats_display])
|
| 157 |
refresh_button.click(display_saved_chats, inputs=[], outputs=saved_chats_display)
|
| 158 |
|
| 159 |
+
if __name__ == "__main__":
|
| 160 |
chat_interface.launch()
|