Update app.py
Browse files
app.py
CHANGED
@@ -70,7 +70,6 @@ custom_css = """
|
|
70 |
background-color: #f8f9fa;
|
71 |
color: #333;
|
72 |
}
|
73 |
-
|
74 |
/* Header styles */
|
75 |
.gradio-header {
|
76 |
background-color: #007bff;
|
@@ -81,16 +80,13 @@ custom_css = """
|
|
81 |
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
82 |
animation: fadeIn 1s ease-out;
|
83 |
}
|
84 |
-
|
85 |
.gradio-header h1 {
|
86 |
font-size: 2.5rem;
|
87 |
}
|
88 |
-
|
89 |
.gradio-header h3 {
|
90 |
font-size: 1.2rem;
|
91 |
margin-top: 10px;
|
92 |
}
|
93 |
-
|
94 |
/* Chatbot container styles */
|
95 |
.gradio-chatbot {
|
96 |
background-color: #fff;
|
@@ -101,7 +97,6 @@ custom_css = """
|
|
101 |
overflow-y: auto;
|
102 |
animation: fadeIn 2s ease-out;
|
103 |
}
|
104 |
-
|
105 |
/* Input field styles */
|
106 |
.gradio-textbox, .gradio-dropdown, .gradio-image {
|
107 |
border-radius: 8px;
|
@@ -112,11 +107,9 @@ custom_css = """
|
|
112 |
font-size: 1rem;
|
113 |
transition: all 0.3s ease;
|
114 |
}
|
115 |
-
|
116 |
.gradio-textbox:focus, .gradio-dropdown:focus, .gradio-image:focus {
|
117 |
border-color: #007bff;
|
118 |
}
|
119 |
-
|
120 |
/* Button styles */
|
121 |
.gradio-button {
|
122 |
background-color: #007bff;
|
@@ -128,20 +121,16 @@ custom_css = """
|
|
128 |
cursor: pointer;
|
129 |
transition: all 0.3s ease;
|
130 |
}
|
131 |
-
|
132 |
.gradio-button:hover {
|
133 |
background-color: #0056b3;
|
134 |
}
|
135 |
-
|
136 |
.gradio-button:active {
|
137 |
transform: scale(0.95);
|
138 |
}
|
139 |
-
|
140 |
/* Chat history styles */
|
141 |
.gradio-chatbot .message {
|
142 |
margin-bottom: 10px;
|
143 |
}
|
144 |
-
|
145 |
.gradio-chatbot .user {
|
146 |
background-color: #007bff;
|
147 |
color: white;
|
@@ -150,7 +139,6 @@ custom_css = """
|
|
150 |
max-width: 70%;
|
151 |
animation: slideInUser 0.5s ease-out;
|
152 |
}
|
153 |
-
|
154 |
.gradio-chatbot .assistant {
|
155 |
background-color: #f1f1f1;
|
156 |
color: #333;
|
@@ -160,28 +148,23 @@ custom_css = """
|
|
160 |
margin-left: auto;
|
161 |
animation: slideInAssistant 0.5s ease-out;
|
162 |
}
|
163 |
-
|
164 |
/* Clear button style */
|
165 |
.gradio-button.clear-history {
|
166 |
background-color: #dc3545;
|
167 |
margin-left: 10px;
|
168 |
}
|
169 |
-
|
170 |
.gradio-button.clear-history:hover {
|
171 |
background-color: #c82333;
|
172 |
}
|
173 |
-
|
174 |
/* Animation keyframes */
|
175 |
@keyframes fadeIn {
|
176 |
0% { opacity: 0; }
|
177 |
100% { opacity: 1; }
|
178 |
}
|
179 |
-
|
180 |
@keyframes slideInUser {
|
181 |
0% { transform: translateX(-100%); }
|
182 |
100% { transform: translateX(0); }
|
183 |
}
|
184 |
-
|
185 |
@keyframes slideInAssistant {
|
186 |
0% { transform: translateX(100%); }
|
187 |
100% { transform: translateX(0); }
|
@@ -197,6 +180,22 @@ def create_interface():
|
|
197 |
<h3>Interact with a chatbot using text or image inputs</h3>
|
198 |
</div>
|
199 |
""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
|
201 |
with gr.Row():
|
202 |
openai_api_key = gr.Textbox(label="Enter OpenAI API Key", type="password", placeholder="sk-...", interactive=True)
|
|
|
70 |
background-color: #f8f9fa;
|
71 |
color: #333;
|
72 |
}
|
|
|
73 |
/* Header styles */
|
74 |
.gradio-header {
|
75 |
background-color: #007bff;
|
|
|
80 |
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
81 |
animation: fadeIn 1s ease-out;
|
82 |
}
|
|
|
83 |
.gradio-header h1 {
|
84 |
font-size: 2.5rem;
|
85 |
}
|
|
|
86 |
.gradio-header h3 {
|
87 |
font-size: 1.2rem;
|
88 |
margin-top: 10px;
|
89 |
}
|
|
|
90 |
/* Chatbot container styles */
|
91 |
.gradio-chatbot {
|
92 |
background-color: #fff;
|
|
|
97 |
overflow-y: auto;
|
98 |
animation: fadeIn 2s ease-out;
|
99 |
}
|
|
|
100 |
/* Input field styles */
|
101 |
.gradio-textbox, .gradio-dropdown, .gradio-image {
|
102 |
border-radius: 8px;
|
|
|
107 |
font-size: 1rem;
|
108 |
transition: all 0.3s ease;
|
109 |
}
|
|
|
110 |
.gradio-textbox:focus, .gradio-dropdown:focus, .gradio-image:focus {
|
111 |
border-color: #007bff;
|
112 |
}
|
|
|
113 |
/* Button styles */
|
114 |
.gradio-button {
|
115 |
background-color: #007bff;
|
|
|
121 |
cursor: pointer;
|
122 |
transition: all 0.3s ease;
|
123 |
}
|
|
|
124 |
.gradio-button:hover {
|
125 |
background-color: #0056b3;
|
126 |
}
|
|
|
127 |
.gradio-button:active {
|
128 |
transform: scale(0.95);
|
129 |
}
|
|
|
130 |
/* Chat history styles */
|
131 |
.gradio-chatbot .message {
|
132 |
margin-bottom: 10px;
|
133 |
}
|
|
|
134 |
.gradio-chatbot .user {
|
135 |
background-color: #007bff;
|
136 |
color: white;
|
|
|
139 |
max-width: 70%;
|
140 |
animation: slideInUser 0.5s ease-out;
|
141 |
}
|
|
|
142 |
.gradio-chatbot .assistant {
|
143 |
background-color: #f1f1f1;
|
144 |
color: #333;
|
|
|
148 |
margin-left: auto;
|
149 |
animation: slideInAssistant 0.5s ease-out;
|
150 |
}
|
|
|
151 |
/* Clear button style */
|
152 |
.gradio-button.clear-history {
|
153 |
background-color: #dc3545;
|
154 |
margin-left: 10px;
|
155 |
}
|
|
|
156 |
.gradio-button.clear-history:hover {
|
157 |
background-color: #c82333;
|
158 |
}
|
|
|
159 |
/* Animation keyframes */
|
160 |
@keyframes fadeIn {
|
161 |
0% { opacity: 0; }
|
162 |
100% { opacity: 1; }
|
163 |
}
|
|
|
164 |
@keyframes slideInUser {
|
165 |
0% { transform: translateX(-100%); }
|
166 |
100% { transform: translateX(0); }
|
167 |
}
|
|
|
168 |
@keyframes slideInAssistant {
|
169 |
0% { transform: translateX(100%); }
|
170 |
100% { transform: translateX(0); }
|
|
|
180 |
<h3>Interact with a chatbot using text or image inputs</h3>
|
181 |
</div>
|
182 |
""")
|
183 |
+
|
184 |
+
# Add a description below the header
|
185 |
+
gr.Markdown("""
|
186 |
+
### Description:
|
187 |
+
This is a multimodal chatbot that can handle both text and image inputs.
|
188 |
+
- You can ask questions or provide text, and the assistant will respond.
|
189 |
+
- You can also upload an image, and the assistant will process it and answer questions about the image.
|
190 |
+
- Enter your OpenAI API key to start interacting with the model.
|
191 |
+
- You can use the 'Clear History' button to remove the conversation history.
|
192 |
+
- "o1" is for image chat and "o3-mini" is for text chat.
|
193 |
+
### Reasoning Effort:
|
194 |
+
The reasoning effort controls how complex or detailed the assistant's answers should be.
|
195 |
+
- **Low**: Provides quick, concise answers with minimal reasoning or details.
|
196 |
+
- **Medium**: Offers a balanced response with a reasonable level of detail and thought.
|
197 |
+
- **High**: Produces more detailed, analytical, or thoughtful responses, requiring deeper reasoning.
|
198 |
+
""")
|
199 |
|
200 |
with gr.Row():
|
201 |
openai_api_key = gr.Textbox(label="Enter OpenAI API Key", type="password", placeholder="sk-...", interactive=True)
|