Update app.py
Browse files
app.py
CHANGED
|
@@ -108,7 +108,7 @@ def execute_agent_task(
|
|
| 108 |
return f'Agent processing failure: {str(e)}'
|
| 109 |
|
| 110 |
|
| 111 |
-
# ---
|
| 112 |
custom_css = """
|
| 113 |
body, .gradio-container {
|
| 114 |
background-color: #0b1818 !important;
|
|
@@ -128,22 +128,21 @@ footer { display: none !important; }
|
|
| 128 |
padding: 0 !important;
|
| 129 |
}
|
| 130 |
|
| 131 |
-
/* Sidebar
|
| 132 |
#sidebar-panel {
|
| 133 |
background-color: #512da8 !important;
|
| 134 |
padding: 35px 25px !important;
|
| 135 |
display: flex;
|
| 136 |
flex-direction: column;
|
| 137 |
justify-content: space-between;
|
| 138 |
-
min-height: 100%;
|
| 139 |
}
|
| 140 |
|
| 141 |
-
/* Right Main
|
| 142 |
#main-control-center {
|
| 143 |
-
padding:
|
| 144 |
}
|
| 145 |
|
| 146 |
-
/* Card Styling
|
| 147 |
.card-box {
|
| 148 |
background-color: #ffffff !important;
|
| 149 |
border-radius: 10px !important;
|
|
@@ -170,7 +169,7 @@ footer { display: none !important; }
|
|
| 170 |
box-shadow: none !important;
|
| 171 |
}
|
| 172 |
|
| 173 |
-
/* Dropdown
|
| 174 |
.custom-dropdown {
|
| 175 |
background-color: #162e2e !important;
|
| 176 |
border: 1px solid #204545 !important;
|
|
@@ -178,7 +177,7 @@ footer { display: none !important; }
|
|
| 178 |
color: #ffffff !important;
|
| 179 |
}
|
| 180 |
|
| 181 |
-
/* Buttons */
|
| 182 |
.blue-btn button {
|
| 183 |
background-color: #1a73e8 !important;
|
| 184 |
color: #ffffff !important;
|
|
@@ -186,7 +185,7 @@ footer { display: none !important; }
|
|
| 186 |
font-size: 14px !important;
|
| 187 |
border-radius: 6px !important;
|
| 188 |
border: none !important;
|
| 189 |
-
padding: 12px
|
| 190 |
box-shadow: 0 4px 12px rgba(26,115,232,0.3) !important;
|
| 191 |
transition: all 0.2s ease !important;
|
| 192 |
}
|
|
@@ -196,7 +195,7 @@ footer { display: none !important; }
|
|
| 196 |
}
|
| 197 |
"""
|
| 198 |
|
| 199 |
-
# --- GRADIO
|
| 200 |
with gr.Blocks(title="XTranslate Agentic Studio") as demo:
|
| 201 |
|
| 202 |
with gr.Row(elem_id="main-workspace"):
|
|
@@ -225,7 +224,7 @@ with gr.Blocks(title="XTranslate Agentic Studio") as demo:
|
|
| 225 |
# RIGHT MAIN CONTROL CENTER
|
| 226 |
with gr.Column(scale=3, elem_id="main-control-center"):
|
| 227 |
|
| 228 |
-
# HEADER
|
| 229 |
gr.HTML(
|
| 230 |
"""
|
| 231 |
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;">
|
|
@@ -243,7 +242,44 @@ with gr.Blocks(title="XTranslate Agentic Studio") as demo:
|
|
| 243 |
"""
|
| 244 |
)
|
| 245 |
|
| 246 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
with gr.Row():
|
| 248 |
# LEFT INPUT CARD
|
| 249 |
with gr.Column(elem_classes=["card-box"]):
|
|
@@ -282,41 +318,6 @@ with gr.Blocks(title="XTranslate Agentic Studio") as demo:
|
|
| 282 |
elem_classes=["output-textarea"],
|
| 283 |
)
|
| 284 |
|
| 285 |
-
# SERVICE SELECTOR
|
| 286 |
-
gr.HTML(
|
| 287 |
-
"""<div style="margin-top: 15px; margin-bottom: 5px; font-size: 12px; font-weight: bold; color: #81a1a1; text-transform: uppercase;">ACTIVE NEURAL TRANSLATION NETWORK SERVICE SELECTOR</div>"""
|
| 288 |
-
)
|
| 289 |
-
service_select = gr.Dropdown(
|
| 290 |
-
choices=[
|
| 291 |
-
"Google Cloud Neural Network",
|
| 292 |
-
"MyMemory Shared API Network",
|
| 293 |
-
],
|
| 294 |
-
value="Google Cloud Neural Network",
|
| 295 |
-
show_label=False,
|
| 296 |
-
container=False,
|
| 297 |
-
elem_classes=["custom-dropdown"],
|
| 298 |
-
)
|
| 299 |
-
|
| 300 |
-
# FUNCTIONALITIES LABEL
|
| 301 |
-
gr.HTML(
|
| 302 |
-
"""<div style="margin-top: 20px; margin-bottom: 10px; font-size: 14px; font-weight: bold; color: #20c997;">ENABLED LINGUISTIC SELECT FUNCTIONALITIES:-</div>"""
|
| 303 |
-
)
|
| 304 |
-
|
| 305 |
-
# ACTION BUTTONS ROW
|
| 306 |
-
with gr.Row():
|
| 307 |
-
btn_translate = gr.Button(
|
| 308 |
-
"Translate Text", elem_classes=["blue-btn"]
|
| 309 |
-
)
|
| 310 |
-
btn_detect = gr.Button(
|
| 311 |
-
"Detect Language", elem_classes=["blue-btn"]
|
| 312 |
-
)
|
| 313 |
-
btn_transliterate = gr.Button(
|
| 314 |
-
"Transliterate Script", elem_classes=["blue-btn"]
|
| 315 |
-
)
|
| 316 |
-
btn_annotate = gr.Button(
|
| 317 |
-
"Annotate Structure", elem_classes=["blue-btn"]
|
| 318 |
-
)
|
| 319 |
-
|
| 320 |
# EVENT ROUTING
|
| 321 |
btn_translate.click(
|
| 322 |
fn=lambda t, s, tg, srv: execute_agent_task(
|
|
|
|
| 108 |
return f'Agent processing failure: {str(e)}'
|
| 109 |
|
| 110 |
|
| 111 |
+
# --- BALANCED DARK THEME STYLING ---
|
| 112 |
custom_css = """
|
| 113 |
body, .gradio-container {
|
| 114 |
background-color: #0b1818 !important;
|
|
|
|
| 128 |
padding: 0 !important;
|
| 129 |
}
|
| 130 |
|
| 131 |
+
/* Sidebar Styling */
|
| 132 |
#sidebar-panel {
|
| 133 |
background-color: #512da8 !important;
|
| 134 |
padding: 35px 25px !important;
|
| 135 |
display: flex;
|
| 136 |
flex-direction: column;
|
| 137 |
justify-content: space-between;
|
|
|
|
| 138 |
}
|
| 139 |
|
| 140 |
+
/* Right Main Panel Padding */
|
| 141 |
#main-control-center {
|
| 142 |
+
padding: 30px !important;
|
| 143 |
}
|
| 144 |
|
| 145 |
+
/* Textarea Card Styling */
|
| 146 |
.card-box {
|
| 147 |
background-color: #ffffff !important;
|
| 148 |
border-radius: 10px !important;
|
|
|
|
| 169 |
box-shadow: none !important;
|
| 170 |
}
|
| 171 |
|
| 172 |
+
/* Dropdown styling */
|
| 173 |
.custom-dropdown {
|
| 174 |
background-color: #162e2e !important;
|
| 175 |
border: 1px solid #204545 !important;
|
|
|
|
| 177 |
color: #ffffff !important;
|
| 178 |
}
|
| 179 |
|
| 180 |
+
/* Primary Action Buttons */
|
| 181 |
.blue-btn button {
|
| 182 |
background-color: #1a73e8 !important;
|
| 183 |
color: #ffffff !important;
|
|
|
|
| 185 |
font-size: 14px !important;
|
| 186 |
border-radius: 6px !important;
|
| 187 |
border: none !important;
|
| 188 |
+
padding: 12px 16px !important;
|
| 189 |
box-shadow: 0 4px 12px rgba(26,115,232,0.3) !important;
|
| 190 |
transition: all 0.2s ease !important;
|
| 191 |
}
|
|
|
|
| 195 |
}
|
| 196 |
"""
|
| 197 |
|
| 198 |
+
# --- GRADIO BUILD ---
|
| 199 |
with gr.Blocks(title="XTranslate Agentic Studio") as demo:
|
| 200 |
|
| 201 |
with gr.Row(elem_id="main-workspace"):
|
|
|
|
| 224 |
# RIGHT MAIN CONTROL CENTER
|
| 225 |
with gr.Column(scale=3, elem_id="main-control-center"):
|
| 226 |
|
| 227 |
+
# 1. TOP HEADER & STATUS
|
| 228 |
gr.HTML(
|
| 229 |
"""
|
| 230 |
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;">
|
|
|
|
| 242 |
"""
|
| 243 |
)
|
| 244 |
|
| 245 |
+
# 2. FUNCTIONALITIES AT TOP (ACTION BUTTONS & NETWORK SELECTOR)
|
| 246 |
+
gr.HTML(
|
| 247 |
+
"""<div style="margin-bottom: 8px; font-size: 14px; font-weight: bold; color: #20c997;">ENABLED LINGUISTIC SELECT FUNCTIONALITIES:-</div>"""
|
| 248 |
+
)
|
| 249 |
+
|
| 250 |
+
with gr.Row():
|
| 251 |
+
btn_translate = gr.Button(
|
| 252 |
+
"Translate Text", elem_classes=["blue-btn"]
|
| 253 |
+
)
|
| 254 |
+
btn_detect = gr.Button(
|
| 255 |
+
"Detect Language", elem_classes=["blue-btn"]
|
| 256 |
+
)
|
| 257 |
+
btn_transliterate = gr.Button(
|
| 258 |
+
"Transliterate Script", elem_classes=["blue-btn"]
|
| 259 |
+
)
|
| 260 |
+
btn_annotate = gr.Button(
|
| 261 |
+
"Annotate Structure", elem_classes=["blue-btn"]
|
| 262 |
+
)
|
| 263 |
+
|
| 264 |
+
gr.HTML(
|
| 265 |
+
"""<div style="margin-top: 15px; margin-bottom: 5px; font-size: 12px; font-weight: bold; color: #81a1a1; text-transform: uppercase;">ACTIVE NEURAL TRANSLATION NETWORK SERVICE SELECTOR</div>"""
|
| 266 |
+
)
|
| 267 |
+
service_select = gr.Dropdown(
|
| 268 |
+
choices=[
|
| 269 |
+
"Google Cloud Neural Network",
|
| 270 |
+
"MyMemory Shared API Network",
|
| 271 |
+
],
|
| 272 |
+
value="Google Cloud Neural Network",
|
| 273 |
+
show_label=False,
|
| 274 |
+
container=False,
|
| 275 |
+
elem_classes=["custom-dropdown"],
|
| 276 |
+
)
|
| 277 |
+
|
| 278 |
+
# 3. INPUT / OUTPUT (I/O) BELOW FUNCTIONALITIES
|
| 279 |
+
gr.HTML(
|
| 280 |
+
"""<div style="margin-top: 20px; margin-bottom: 8px; font-size: 12px; font-weight: bold; color: #81a1a1; text-transform: uppercase;">INPUT / OUTPUT WORKSPACE</div>"""
|
| 281 |
+
)
|
| 282 |
+
|
| 283 |
with gr.Row():
|
| 284 |
# LEFT INPUT CARD
|
| 285 |
with gr.Column(elem_classes=["card-box"]):
|
|
|
|
| 318 |
elem_classes=["output-textarea"],
|
| 319 |
)
|
| 320 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 321 |
# EVENT ROUTING
|
| 322 |
btn_translate.click(
|
| 323 |
fn=lambda t, s, tg, srv: execute_agent_task(
|