Update app.py
Browse files
app.py
CHANGED
|
@@ -125,7 +125,75 @@ def handle_input(user_prompt, image=None, audio=None, websearch=False, document=
|
|
| 125 |
|
| 126 |
# Gradio UI Setup
|
| 127 |
def create_ui():
|
| 128 |
-
with gr.Blocks(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
gr.Markdown("# AI Assistant")
|
| 130 |
with gr.Row():
|
| 131 |
with gr.Column(scale=2):
|
|
@@ -133,7 +201,7 @@ def create_ui():
|
|
| 133 |
with gr.Column(scale=1):
|
| 134 |
image_input = gr.Image(type="filepath", label="Upload an image", elem_id="image-icon")
|
| 135 |
audio_input = gr.Audio(type="filepath", label="Upload audio", elem_id="mic-icon")
|
| 136 |
-
document_input = gr.File(type="filepath", label="Upload a document", elem_id="document-icon")
|
| 137 |
voice_only_mode = gr.Checkbox(label="Enable Voice Only Mode", elem_id="voice-only-mode")
|
| 138 |
websearch_mode = gr.Checkbox(label="Enable Web Search", elem_id="websearch-mode")
|
| 139 |
with gr.Column(scale=1):
|
|
|
|
| 125 |
|
| 126 |
# Gradio UI Setup
|
| 127 |
def create_ui():
|
| 128 |
+
with gr.Blocks(css="""
|
| 129 |
+
/* Overall Styling */
|
| 130 |
+
body {
|
| 131 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 132 |
+
background-color: #f4f4f4;
|
| 133 |
+
margin: 0;
|
| 134 |
+
padding: 0;
|
| 135 |
+
color: #333;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
/* Title Styling */
|
| 139 |
+
.gradio-container h1 {
|
| 140 |
+
text-align: center;
|
| 141 |
+
padding: 20px 0;
|
| 142 |
+
background-color: #007bff; /* Example color */
|
| 143 |
+
color: white;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
/* Input Area Styling */
|
| 147 |
+
.gradio-container .gr-row {
|
| 148 |
+
display: flex;
|
| 149 |
+
justify-content: space-around;
|
| 150 |
+
align-items: center;
|
| 151 |
+
padding: 20px;
|
| 152 |
+
}
|
| 153 |
+
|
| 154 |
+
.gradio-container .gr-column {
|
| 155 |
+
flex: 1;
|
| 156 |
+
margin: 0 10px;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
/* Textbox Styling */
|
| 160 |
+
.gradio-container textarea {
|
| 161 |
+
width: calc(100% - 20px);
|
| 162 |
+
padding: 10px;
|
| 163 |
+
border: 2px solid #ccc;
|
| 164 |
+
border-radius: 5px;
|
| 165 |
+
font-size: 16px;
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
/* Button Styling */
|
| 169 |
+
.gradio-container button {
|
| 170 |
+
background-color: #007bff; /* Example color */
|
| 171 |
+
color: white;
|
| 172 |
+
padding: 12px 20px;
|
| 173 |
+
border: none;
|
| 174 |
+
border-radius: 5px;
|
| 175 |
+
cursor: pointer;
|
| 176 |
+
font-size: 16px;
|
| 177 |
+
transition: background-color 0.3s;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
.gradio-container button:hover {
|
| 181 |
+
background-color: #0056b3; /* Example darker color */
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
/* Output Area Styling */
|
| 185 |
+
.gradio-container .output-area {
|
| 186 |
+
padding: 20px;
|
| 187 |
+
text-align: center;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
/* Image Styling */
|
| 191 |
+
.gradio-container img {
|
| 192 |
+
max-width: 100%;
|
| 193 |
+
height: auto;
|
| 194 |
+
border-radius: 5px;
|
| 195 |
+
}
|
| 196 |
+
""") as demo:
|
| 197 |
gr.Markdown("# AI Assistant")
|
| 198 |
with gr.Row():
|
| 199 |
with gr.Column(scale=2):
|
|
|
|
| 201 |
with gr.Column(scale=1):
|
| 202 |
image_input = gr.Image(type="filepath", label="Upload an image", elem_id="image-icon")
|
| 203 |
audio_input = gr.Audio(type="filepath", label="Upload audio", elem_id="mic-icon")
|
| 204 |
+
document_input = gr.File(type="filepath", label="Upload a document", elem_id="document-icon")
|
| 205 |
voice_only_mode = gr.Checkbox(label="Enable Voice Only Mode", elem_id="voice-only-mode")
|
| 206 |
websearch_mode = gr.Checkbox(label="Enable Web Search", elem_id="websearch-mode")
|
| 207 |
with gr.Column(scale=1):
|