Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -305,67 +305,234 @@ def load_sample_json():
|
|
| 305 |
# GRADIO INTERFACE
|
| 306 |
# ============================================================================
|
| 307 |
|
| 308 |
-
# Custom CSS
|
| 309 |
custom_css = """
|
|
|
|
|
|
|
| 310 |
.gradio-container {
|
| 311 |
-
font-family: '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 312 |
}
|
| 313 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 314 |
font-size: 16px !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 315 |
}
|
| 316 |
"""
|
| 317 |
|
| 318 |
# Create Gradio interface
|
| 319 |
with gr.Blocks(theme=gr.themes.Soft(), css=custom_css, title="MissionControlMCP Demo") as demo:
|
| 320 |
|
| 321 |
-
gr.Markdown(""
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
**Try all 8 powerful tools in your browser!** No installation needed.
|
| 325 |
|
| 326 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 327 |
""")
|
| 328 |
|
| 329 |
with gr.Tabs():
|
| 330 |
|
| 331 |
# ====== TAB 1: PDF READER ======
|
| 332 |
with gr.Tab("π PDF Reader"):
|
| 333 |
-
gr.Markdown("
|
|
|
|
|
|
|
|
|
|
| 334 |
|
| 335 |
with gr.Row():
|
| 336 |
-
with gr.Column():
|
| 337 |
-
pdf_input = gr.File(
|
| 338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 339 |
|
| 340 |
-
with gr.Column():
|
| 341 |
-
pdf_output = gr.Textbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
pdf_img = gr.Image(label="Preview", visible=False)
|
| 343 |
|
| 344 |
pdf_btn.click(tool_pdf_reader, inputs=[pdf_input], outputs=[pdf_output, pdf_img])
|
| 345 |
|
| 346 |
-
gr.
|
| 347 |
|
| 348 |
# ====== TAB 2: TEXT EXTRACTOR ======
|
| 349 |
with gr.Tab("π Text Extractor"):
|
| 350 |
-
gr.Markdown("
|
|
|
|
|
|
|
|
|
|
| 351 |
|
| 352 |
with gr.Row():
|
| 353 |
-
with gr.Column():
|
| 354 |
text_input = gr.Textbox(
|
| 355 |
-
label="Enter Text",
|
| 356 |
-
lines=
|
| 357 |
-
placeholder="Paste
|
|
|
|
| 358 |
)
|
| 359 |
text_operation = gr.Radio(
|
| 360 |
["keywords", "summarize", "clean", "chunk"],
|
| 361 |
-
label="Operation",
|
| 362 |
-
value="keywords"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 363 |
)
|
| 364 |
-
text_length = gr.Slider(100, 1000, 300, label="Max Length (for summarize/chunk)")
|
| 365 |
-
text_btn = gr.Button("β¨ Process Text", variant="primary")
|
| 366 |
|
| 367 |
-
with gr.Column():
|
| 368 |
-
text_output = gr.Textbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 369 |
|
| 370 |
text_btn.click(
|
| 371 |
tool_text_extractor,
|
|
@@ -376,23 +543,43 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css, title="MissionControlMCP
|
|
| 376 |
gr.Examples([
|
| 377 |
["Artificial Intelligence is transforming businesses worldwide. Companies are leveraging AI for automation, decision-making, and customer service. Machine learning models can now process vast amounts of data and provide actionable insights.", "keywords", 300],
|
| 378 |
["Climate change is one of the most pressing challenges of our time. Rising temperatures, extreme weather events, and environmental degradation require urgent action.", "summarize", 300]
|
| 379 |
-
], inputs=[text_input, text_operation, text_length])
|
| 380 |
|
| 381 |
# ====== TAB 3: WEB FETCHER ======
|
| 382 |
with gr.Tab("π Web Fetcher"):
|
| 383 |
-
gr.Markdown("
|
|
|
|
|
|
|
|
|
|
| 384 |
|
| 385 |
with gr.Row():
|
| 386 |
-
with gr.Column():
|
| 387 |
web_input = gr.Textbox(
|
| 388 |
-
label="Website URL",
|
| 389 |
placeholder="https://example.com",
|
| 390 |
-
value="https://example.com"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 391 |
)
|
| 392 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 393 |
|
| 394 |
-
with gr.Column():
|
| 395 |
-
web_output = gr.Textbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 396 |
|
| 397 |
web_btn.click(tool_web_fetcher, inputs=[web_input], outputs=[web_output])
|
| 398 |
|
|
@@ -400,23 +587,44 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css, title="MissionControlMCP
|
|
| 400 |
["https://example.com"],
|
| 401 |
["https://python.org"],
|
| 402 |
["https://github.com"]
|
| 403 |
-
], inputs=[web_input])
|
| 404 |
|
| 405 |
# ====== TAB 4: RAG SEARCH ======
|
| 406 |
with gr.Tab("π RAG Search"):
|
| 407 |
-
gr.Markdown("
|
|
|
|
|
|
|
|
|
|
| 408 |
|
| 409 |
with gr.Row():
|
| 410 |
-
with gr.Column():
|
| 411 |
rag_input = gr.Textbox(
|
| 412 |
-
label="Search Query",
|
| 413 |
placeholder="What are you looking for?",
|
| 414 |
-
value="What is machine learning?"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 415 |
)
|
| 416 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 417 |
|
| 418 |
-
with gr.Column():
|
| 419 |
-
rag_output = gr.Textbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 420 |
|
| 421 |
rag_btn.click(tool_rag_search, inputs=[rag_input], outputs=[rag_output])
|
| 422 |
|
|
@@ -425,56 +633,98 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css, title="MissionControlMCP
|
|
| 425 |
["How to reduce carbon emissions?"],
|
| 426 |
["What are modern web frameworks?"],
|
| 427 |
["Digital marketing strategies"]
|
| 428 |
-
], inputs=[rag_input])
|
| 429 |
|
| 430 |
# ====== TAB 5: DATA VISUALIZER ======
|
| 431 |
with gr.Tab("π Data Visualizer"):
|
| 432 |
-
gr.Markdown("
|
|
|
|
|
|
|
|
|
|
| 433 |
|
| 434 |
with gr.Row():
|
| 435 |
-
with gr.Column():
|
| 436 |
viz_csv = gr.Textbox(
|
| 437 |
-
label="CSV Data",
|
| 438 |
-
lines=
|
| 439 |
value=load_sample_csv(),
|
| 440 |
-
placeholder="month,revenue,costs\nJan,100000,60000"
|
|
|
|
| 441 |
)
|
| 442 |
viz_chart = gr.Radio(
|
| 443 |
["line", "bar", "pie", "scatter"],
|
| 444 |
-
label="Chart Type",
|
| 445 |
-
value="line"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 446 |
)
|
| 447 |
-
viz_x = gr.Textbox(label="X Column", value="month")
|
| 448 |
-
viz_y = gr.Textbox(label="Y Column", value="revenue")
|
| 449 |
-
viz_title = gr.Textbox(label="Chart Title", value="Monthly Revenue")
|
| 450 |
-
viz_btn = gr.Button("π Create Chart", variant="primary")
|
| 451 |
|
| 452 |
-
with gr.Column():
|
| 453 |
-
viz_output = gr.Textbox(
|
| 454 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 455 |
|
| 456 |
viz_btn.click(
|
| 457 |
tool_data_visualizer,
|
| 458 |
inputs=[viz_csv, viz_chart, viz_x, viz_y, viz_title],
|
| 459 |
outputs=[viz_output, viz_img]
|
| 460 |
)
|
|
|
|
|
|
|
| 461 |
|
| 462 |
# ====== TAB 6: EMAIL CLASSIFIER ======
|
| 463 |
with gr.Tab("π§ Email Classifier"):
|
| 464 |
-
gr.Markdown("
|
|
|
|
|
|
|
|
|
|
| 465 |
|
| 466 |
with gr.Row():
|
| 467 |
-
with gr.Column():
|
| 468 |
email_input = gr.Textbox(
|
| 469 |
-
label="Email
|
| 470 |
-
lines=
|
| 471 |
value=load_sample_email(),
|
| 472 |
-
placeholder="Paste email content here..."
|
|
|
|
| 473 |
)
|
| 474 |
-
email_btn = gr.Button(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 475 |
|
| 476 |
-
with gr.Column():
|
| 477 |
-
email_output = gr.Textbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 478 |
|
| 479 |
email_btn.click(tool_email_classifier, inputs=[email_input], outputs=[email_output])
|
| 480 |
|
|
@@ -482,56 +732,117 @@ with gr.Blocks(theme=gr.themes.Soft(), css=custom_css, title="MissionControlMCP
|
|
| 482 |
["I am writing to complain about the poor service I received at your store yesterday."],
|
| 483 |
["Could you please send me more information about your pricing plans?"],
|
| 484 |
["URGENT: The server is down and customers cannot access the website!"]
|
| 485 |
-
], inputs=[email_input])
|
| 486 |
|
| 487 |
# ====== TAB 7: KPI GENERATOR ======
|
| 488 |
with gr.Tab("π KPI Generator"):
|
| 489 |
-
gr.Markdown("
|
|
|
|
|
|
|
|
|
|
| 490 |
|
| 491 |
with gr.Row():
|
| 492 |
-
with gr.Column():
|
| 493 |
kpi_json = gr.Textbox(
|
| 494 |
-
label="Business Data (JSON)",
|
| 495 |
-
lines=
|
| 496 |
value=load_sample_json(),
|
| 497 |
-
placeholder='{"revenue": 1000000, "costs": 600000}'
|
|
|
|
| 498 |
)
|
| 499 |
kpi_metrics = gr.CheckboxGroup(
|
| 500 |
["revenue", "growth", "efficiency", "customer", "operational"],
|
| 501 |
-
label="Metrics to Calculate",
|
| 502 |
-
value=["revenue", "growth", "efficiency"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 503 |
)
|
| 504 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 505 |
|
| 506 |
-
with gr.Column():
|
| 507 |
-
kpi_output = gr.Textbox(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 508 |
|
| 509 |
kpi_btn.click(
|
| 510 |
tool_kpi_generator,
|
| 511 |
inputs=[kpi_json, kpi_metrics],
|
| 512 |
outputs=[kpi_output]
|
| 513 |
)
|
|
|
|
|
|
|
| 514 |
|
| 515 |
# Footer
|
| 516 |
-
gr.
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 535 |
""")
|
| 536 |
|
| 537 |
|
|
|
|
| 305 |
# GRADIO INTERFACE
|
| 306 |
# ============================================================================
|
| 307 |
|
| 308 |
+
# Custom CSS for beautiful UI
|
| 309 |
custom_css = """
|
| 310 |
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
|
| 311 |
+
|
| 312 |
.gradio-container {
|
| 313 |
+
font-family: 'Inter', sans-serif !important;
|
| 314 |
+
max-width: 1400px !important;
|
| 315 |
+
margin: 0 auto !important;
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
/* Header styling */
|
| 319 |
+
.gradio-container h1 {
|
| 320 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 321 |
+
-webkit-background-clip: text;
|
| 322 |
+
-webkit-text-fill-color: transparent;
|
| 323 |
+
background-clip: text;
|
| 324 |
+
font-size: 3em !important;
|
| 325 |
+
font-weight: 700 !important;
|
| 326 |
+
text-align: center;
|
| 327 |
+
margin-bottom: 0.5em;
|
| 328 |
+
}
|
| 329 |
+
|
| 330 |
+
/* Tab styling */
|
| 331 |
+
.tab-nav {
|
| 332 |
+
border-radius: 12px !important;
|
| 333 |
+
background: linear-gradient(to right, #f8f9fa, #e9ecef) !important;
|
| 334 |
+
padding: 8px !important;
|
| 335 |
+
margin-bottom: 20px !important;
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
button.selected {
|
| 339 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
| 340 |
+
color: white !important;
|
| 341 |
+
border-radius: 8px !important;
|
| 342 |
+
font-weight: 600 !important;
|
| 343 |
+
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
|
| 344 |
}
|
| 345 |
+
|
| 346 |
+
/* Button styling */
|
| 347 |
+
.primary-btn {
|
| 348 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
| 349 |
+
border: none !important;
|
| 350 |
+
color: white !important;
|
| 351 |
+
font-weight: 600 !important;
|
| 352 |
+
border-radius: 10px !important;
|
| 353 |
+
padding: 12px 24px !important;
|
| 354 |
font-size: 16px !important;
|
| 355 |
+
transition: all 0.3s ease !important;
|
| 356 |
+
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
.primary-btn:hover {
|
| 360 |
+
transform: translateY(-2px) !important;
|
| 361 |
+
box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6) !important;
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
/* Input fields */
|
| 365 |
+
textarea, input[type="text"] {
|
| 366 |
+
border-radius: 10px !important;
|
| 367 |
+
border: 2px solid #e9ecef !important;
|
| 368 |
+
padding: 12px !important;
|
| 369 |
+
font-size: 15px !important;
|
| 370 |
+
transition: border-color 0.3s ease !important;
|
| 371 |
+
}
|
| 372 |
+
|
| 373 |
+
textarea:focus, input[type="text"]:focus {
|
| 374 |
+
border-color: #667eea !important;
|
| 375 |
+
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
/* Output boxes */
|
| 379 |
+
.output-class {
|
| 380 |
+
background: linear-gradient(to bottom, #ffffff, #f8f9fa) !important;
|
| 381 |
+
border-radius: 12px !important;
|
| 382 |
+
padding: 20px !important;
|
| 383 |
+
border: 2px solid #e9ecef !important;
|
| 384 |
+
}
|
| 385 |
+
|
| 386 |
+
/* Cards and containers */
|
| 387 |
+
.gr-box {
|
| 388 |
+
border-radius: 12px !important;
|
| 389 |
+
border: 1px solid #e9ecef !important;
|
| 390 |
+
box-shadow: 0 2px 8px rgba(0,0,0,0.05) !important;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
/* Labels */
|
| 394 |
+
label {
|
| 395 |
+
font-weight: 600 !important;
|
| 396 |
+
color: #495057 !important;
|
| 397 |
+
font-size: 14px !important;
|
| 398 |
+
margin-bottom: 8px !important;
|
| 399 |
+
}
|
| 400 |
+
|
| 401 |
+
/* Examples */
|
| 402 |
+
.gr-samples-table {
|
| 403 |
+
border-radius: 10px !important;
|
| 404 |
+
overflow: hidden !important;
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
/* Footer */
|
| 408 |
+
.footer {
|
| 409 |
+
text-align: center;
|
| 410 |
+
padding: 30px;
|
| 411 |
+
background: linear-gradient(to right, #f8f9fa, #e9ecef);
|
| 412 |
+
border-radius: 12px;
|
| 413 |
+
margin-top: 30px;
|
| 414 |
+
}
|
| 415 |
+
|
| 416 |
+
/* Image display */
|
| 417 |
+
.gr-image {
|
| 418 |
+
border-radius: 12px !important;
|
| 419 |
+
border: 2px solid #e9ecef !important;
|
| 420 |
+
box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
/* Radio buttons and checkboxes */
|
| 424 |
+
.gr-radio, .gr-checkbox {
|
| 425 |
+
padding: 10px !important;
|
| 426 |
+
border-radius: 8px !important;
|
| 427 |
+
}
|
| 428 |
+
|
| 429 |
+
/* File upload */
|
| 430 |
+
.gr-file {
|
| 431 |
+
border: 2px dashed #667eea !important;
|
| 432 |
+
border-radius: 12px !important;
|
| 433 |
+
background: linear-gradient(to bottom, #ffffff, #f8f9fa) !important;
|
| 434 |
+
padding: 30px !important;
|
| 435 |
+
}
|
| 436 |
+
|
| 437 |
+
.gr-file:hover {
|
| 438 |
+
border-color: #764ba2 !important;
|
| 439 |
+
background: #f8f9fa !important;
|
| 440 |
}
|
| 441 |
"""
|
| 442 |
|
| 443 |
# Create Gradio interface
|
| 444 |
with gr.Blocks(theme=gr.themes.Soft(), css=custom_css, title="MissionControlMCP Demo") as demo:
|
| 445 |
|
| 446 |
+
gr.Markdown("# π MissionControlMCP")
|
| 447 |
+
gr.Markdown("### Enterprise Automation Tools - Powered by AI")
|
|
|
|
|
|
|
| 448 |
|
| 449 |
+
gr.HTML("""
|
| 450 |
+
<div style="text-align: center; padding: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 15px; color: white; margin-bottom: 30px;">
|
| 451 |
+
<h3 style="color: white; margin: 0;">β¨ Try all 8 powerful tools in your browser - No installation needed! β¨</h3>
|
| 452 |
+
<p style="margin: 10px 0 0 0; opacity: 0.9;">Built for HuggingFace Gradio Hackathon | Claude MCP Integration</p>
|
| 453 |
+
</div>
|
| 454 |
""")
|
| 455 |
|
| 456 |
with gr.Tabs():
|
| 457 |
|
| 458 |
# ====== TAB 1: PDF READER ======
|
| 459 |
with gr.Tab("π PDF Reader"):
|
| 460 |
+
gr.Markdown("""
|
| 461 |
+
### π Extract Text and Metadata from PDF Documents
|
| 462 |
+
Upload any PDF file to extract its content, metadata, and keywords instantly.
|
| 463 |
+
""")
|
| 464 |
|
| 465 |
with gr.Row():
|
| 466 |
+
with gr.Column(scale=1):
|
| 467 |
+
pdf_input = gr.File(
|
| 468 |
+
label="π Upload PDF File",
|
| 469 |
+
file_types=[".pdf"],
|
| 470 |
+
elem_classes=["file-upload"]
|
| 471 |
+
)
|
| 472 |
+
pdf_btn = gr.Button(
|
| 473 |
+
"π Extract Text from PDF",
|
| 474 |
+
variant="primary",
|
| 475 |
+
size="lg",
|
| 476 |
+
elem_classes=["primary-btn"]
|
| 477 |
+
)
|
| 478 |
+
gr.Markdown("""
|
| 479 |
+
**π‘ Tips:**
|
| 480 |
+
- Supports multi-page PDFs
|
| 481 |
+
- Extracts metadata (author, title)
|
| 482 |
+
- Automatically generates keywords
|
| 483 |
+
""")
|
| 484 |
|
| 485 |
+
with gr.Column(scale=2):
|
| 486 |
+
pdf_output = gr.Textbox(
|
| 487 |
+
label="π Extraction Results",
|
| 488 |
+
lines=20,
|
| 489 |
+
elem_classes=["output-class"]
|
| 490 |
+
)
|
| 491 |
pdf_img = gr.Image(label="Preview", visible=False)
|
| 492 |
|
| 493 |
pdf_btn.click(tool_pdf_reader, inputs=[pdf_input], outputs=[pdf_output, pdf_img])
|
| 494 |
|
| 495 |
+
gr.Markdown("*π‘ Try uploading your resume, research paper, or any PDF document!*")
|
| 496 |
|
| 497 |
# ====== TAB 2: TEXT EXTRACTOR ======
|
| 498 |
with gr.Tab("π Text Extractor"):
|
| 499 |
+
gr.Markdown("""
|
| 500 |
+
### π AI-Powered Text Analysis
|
| 501 |
+
Extract keywords, generate summaries, clean text, or split into chunks.
|
| 502 |
+
""")
|
| 503 |
|
| 504 |
with gr.Row():
|
| 505 |
+
with gr.Column(scale=1):
|
| 506 |
text_input = gr.Textbox(
|
| 507 |
+
label="βοΈ Enter Your Text",
|
| 508 |
+
lines=10,
|
| 509 |
+
placeholder="Paste any text here - articles, reports, emails, etc...",
|
| 510 |
+
elem_classes=["input-field"]
|
| 511 |
)
|
| 512 |
text_operation = gr.Radio(
|
| 513 |
["keywords", "summarize", "clean", "chunk"],
|
| 514 |
+
label="π οΈ Select Operation",
|
| 515 |
+
value="keywords",
|
| 516 |
+
info="Choose what to do with your text"
|
| 517 |
+
)
|
| 518 |
+
text_length = gr.Slider(
|
| 519 |
+
100, 1000, 300,
|
| 520 |
+
label="π Max Length (for summarize/chunk)",
|
| 521 |
+
info="Adjust output length"
|
| 522 |
+
)
|
| 523 |
+
text_btn = gr.Button(
|
| 524 |
+
"β¨ Process Text",
|
| 525 |
+
variant="primary",
|
| 526 |
+
size="lg",
|
| 527 |
+
elem_classes=["primary-btn"]
|
| 528 |
)
|
|
|
|
|
|
|
| 529 |
|
| 530 |
+
with gr.Column(scale=2):
|
| 531 |
+
text_output = gr.Textbox(
|
| 532 |
+
label="π Processing Results",
|
| 533 |
+
lines=20,
|
| 534 |
+
elem_classes=["output-class"]
|
| 535 |
+
)
|
| 536 |
|
| 537 |
text_btn.click(
|
| 538 |
tool_text_extractor,
|
|
|
|
| 543 |
gr.Examples([
|
| 544 |
["Artificial Intelligence is transforming businesses worldwide. Companies are leveraging AI for automation, decision-making, and customer service. Machine learning models can now process vast amounts of data and provide actionable insights.", "keywords", 300],
|
| 545 |
["Climate change is one of the most pressing challenges of our time. Rising temperatures, extreme weather events, and environmental degradation require urgent action.", "summarize", 300]
|
| 546 |
+
], inputs=[text_input, text_operation, text_length], label="π Try These Examples")
|
| 547 |
|
| 548 |
# ====== TAB 3: WEB FETCHER ======
|
| 549 |
with gr.Tab("π Web Fetcher"):
|
| 550 |
+
gr.Markdown("""
|
| 551 |
+
### π Scrape and Analyze Web Content
|
| 552 |
+
Fetch content from any website, extract clean text, and analyze it.
|
| 553 |
+
""")
|
| 554 |
|
| 555 |
with gr.Row():
|
| 556 |
+
with gr.Column(scale=1):
|
| 557 |
web_input = gr.Textbox(
|
| 558 |
+
label="π Website URL",
|
| 559 |
placeholder="https://example.com",
|
| 560 |
+
value="https://example.com",
|
| 561 |
+
info="Enter any public website URL"
|
| 562 |
+
)
|
| 563 |
+
web_btn = gr.Button(
|
| 564 |
+
"π Fetch Website",
|
| 565 |
+
variant="primary",
|
| 566 |
+
size="lg",
|
| 567 |
+
elem_classes=["primary-btn"]
|
| 568 |
)
|
| 569 |
+
gr.Markdown("""
|
| 570 |
+
**π‘ Tips:**
|
| 571 |
+
- Works with most public websites
|
| 572 |
+
- Extracts clean text (no HTML)
|
| 573 |
+
- Finds all page links
|
| 574 |
+
- Some sites block bots (e.g., LinkedIn)
|
| 575 |
+
""")
|
| 576 |
|
| 577 |
+
with gr.Column(scale=2):
|
| 578 |
+
web_output = gr.Textbox(
|
| 579 |
+
label="π Website Content",
|
| 580 |
+
lines=20,
|
| 581 |
+
elem_classes=["output-class"]
|
| 582 |
+
)
|
| 583 |
|
| 584 |
web_btn.click(tool_web_fetcher, inputs=[web_input], outputs=[web_output])
|
| 585 |
|
|
|
|
| 587 |
["https://example.com"],
|
| 588 |
["https://python.org"],
|
| 589 |
["https://github.com"]
|
| 590 |
+
], inputs=[web_input], label="π Try These Examples")
|
| 591 |
|
| 592 |
# ====== TAB 4: RAG SEARCH ======
|
| 593 |
with gr.Tab("π RAG Search"):
|
| 594 |
+
gr.Markdown("""
|
| 595 |
+
### π Semantic Document Search with AI
|
| 596 |
+
Search through documents using AI-powered semantic understanding (RAG - Retrieval Augmented Generation).
|
| 597 |
+
""")
|
| 598 |
|
| 599 |
with gr.Row():
|
| 600 |
+
with gr.Column(scale=1):
|
| 601 |
rag_input = gr.Textbox(
|
| 602 |
+
label="π Search Query",
|
| 603 |
placeholder="What are you looking for?",
|
| 604 |
+
value="What is machine learning?",
|
| 605 |
+
lines=3,
|
| 606 |
+
info="Ask questions in natural language"
|
| 607 |
+
)
|
| 608 |
+
rag_btn = gr.Button(
|
| 609 |
+
"π Search Documents",
|
| 610 |
+
variant="primary",
|
| 611 |
+
size="lg",
|
| 612 |
+
elem_classes=["primary-btn"]
|
| 613 |
)
|
| 614 |
+
gr.Markdown("""
|
| 615 |
+
**π‘ How it works:**
|
| 616 |
+
- Uses AI embeddings (FAISS)
|
| 617 |
+
- Understands meaning, not just keywords
|
| 618 |
+
- Searches 5 sample documents
|
| 619 |
+
- Returns relevance scores
|
| 620 |
+
""")
|
| 621 |
|
| 622 |
+
with gr.Column(scale=2):
|
| 623 |
+
rag_output = gr.Textbox(
|
| 624 |
+
label="π Search Results",
|
| 625 |
+
lines=20,
|
| 626 |
+
elem_classes=["output-class"]
|
| 627 |
+
)
|
| 628 |
|
| 629 |
rag_btn.click(tool_rag_search, inputs=[rag_input], outputs=[rag_output])
|
| 630 |
|
|
|
|
| 633 |
["How to reduce carbon emissions?"],
|
| 634 |
["What are modern web frameworks?"],
|
| 635 |
["Digital marketing strategies"]
|
| 636 |
+
], inputs=[rag_input], label="π Try These Searches")
|
| 637 |
|
| 638 |
# ====== TAB 5: DATA VISUALIZER ======
|
| 639 |
with gr.Tab("π Data Visualizer"):
|
| 640 |
+
gr.Markdown("""
|
| 641 |
+
### π Create Beautiful Charts from Your Data
|
| 642 |
+
Transform CSV data into stunning visualizations - line charts, bar charts, pie charts, and scatter plots.
|
| 643 |
+
""")
|
| 644 |
|
| 645 |
with gr.Row():
|
| 646 |
+
with gr.Column(scale=1):
|
| 647 |
viz_csv = gr.Textbox(
|
| 648 |
+
label="π CSV Data",
|
| 649 |
+
lines=10,
|
| 650 |
value=load_sample_csv(),
|
| 651 |
+
placeholder="month,revenue,costs\nJan,100000,60000",
|
| 652 |
+
info="Paste your CSV data here"
|
| 653 |
)
|
| 654 |
viz_chart = gr.Radio(
|
| 655 |
["line", "bar", "pie", "scatter"],
|
| 656 |
+
label="π Chart Type",
|
| 657 |
+
value="line",
|
| 658 |
+
info="Select visualization style"
|
| 659 |
+
)
|
| 660 |
+
viz_x = gr.Textbox(label="π X-Axis Column", value="month")
|
| 661 |
+
viz_y = gr.Textbox(label="π Y-Axis Column", value="revenue")
|
| 662 |
+
viz_title = gr.Textbox(label="π Chart Title", value="Monthly Revenue")
|
| 663 |
+
viz_btn = gr.Button(
|
| 664 |
+
"π Create Chart",
|
| 665 |
+
variant="primary",
|
| 666 |
+
size="lg",
|
| 667 |
+
elem_classes=["primary-btn"]
|
| 668 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 669 |
|
| 670 |
+
with gr.Column(scale=2):
|
| 671 |
+
viz_output = gr.Textbox(
|
| 672 |
+
label="π Chart Status",
|
| 673 |
+
lines=5,
|
| 674 |
+
elem_classes=["output-class"]
|
| 675 |
+
)
|
| 676 |
+
viz_img = gr.Image(label="π Generated Chart", elem_classes=["chart-output"])
|
| 677 |
|
| 678 |
viz_btn.click(
|
| 679 |
tool_data_visualizer,
|
| 680 |
inputs=[viz_csv, viz_chart, viz_x, viz_y, viz_title],
|
| 681 |
outputs=[viz_output, viz_img]
|
| 682 |
)
|
| 683 |
+
|
| 684 |
+
gr.Markdown("*π‘ Sample data is already loaded! Just click 'Create Chart' to see it in action.*")
|
| 685 |
|
| 686 |
# ====== TAB 6: EMAIL CLASSIFIER ======
|
| 687 |
with gr.Tab("π§ Email Classifier"):
|
| 688 |
+
gr.Markdown("""
|
| 689 |
+
### π§ AI-Powered Email Intent Detection
|
| 690 |
+
Automatically classify email intent and detect sentiment - complaint, inquiry, urgent, etc.
|
| 691 |
+
""")
|
| 692 |
|
| 693 |
with gr.Row():
|
| 694 |
+
with gr.Column(scale=1):
|
| 695 |
email_input = gr.Textbox(
|
| 696 |
+
label="βοΈ Email Content",
|
| 697 |
+
lines=12,
|
| 698 |
value=load_sample_email(),
|
| 699 |
+
placeholder="Paste email content here...",
|
| 700 |
+
info="Paste any email text for analysis"
|
| 701 |
)
|
| 702 |
+
email_btn = gr.Button(
|
| 703 |
+
"π― Classify Email",
|
| 704 |
+
variant="primary",
|
| 705 |
+
size="lg",
|
| 706 |
+
elem_classes=["primary-btn"]
|
| 707 |
+
)
|
| 708 |
+
gr.Markdown("""
|
| 709 |
+
**π‘ Detects 10 intents:**
|
| 710 |
+
- Complaint
|
| 711 |
+
- Inquiry
|
| 712 |
+
- Request
|
| 713 |
+
- Feedback
|
| 714 |
+
- Order
|
| 715 |
+
- Meeting
|
| 716 |
+
- Urgent
|
| 717 |
+
- Application
|
| 718 |
+
- Sales
|
| 719 |
+
- Other
|
| 720 |
+
""")
|
| 721 |
|
| 722 |
+
with gr.Column(scale=2):
|
| 723 |
+
email_output = gr.Textbox(
|
| 724 |
+
label="π Classification Results",
|
| 725 |
+
lines=20,
|
| 726 |
+
elem_classes=["output-class"]
|
| 727 |
+
)
|
| 728 |
|
| 729 |
email_btn.click(tool_email_classifier, inputs=[email_input], outputs=[email_output])
|
| 730 |
|
|
|
|
| 732 |
["I am writing to complain about the poor service I received at your store yesterday."],
|
| 733 |
["Could you please send me more information about your pricing plans?"],
|
| 734 |
["URGENT: The server is down and customers cannot access the website!"]
|
| 735 |
+
], inputs=[email_input], label="π Try These Examples")
|
| 736 |
|
| 737 |
# ====== TAB 7: KPI GENERATOR ======
|
| 738 |
with gr.Tab("π KPI Generator"):
|
| 739 |
+
gr.Markdown("""
|
| 740 |
+
### π Business KPI & Analytics Dashboard
|
| 741 |
+
Generate comprehensive business metrics and KPIs from your data automatically.
|
| 742 |
+
""")
|
| 743 |
|
| 744 |
with gr.Row():
|
| 745 |
+
with gr.Column(scale=1):
|
| 746 |
kpi_json = gr.Textbox(
|
| 747 |
+
label="π Business Data (JSON Format)",
|
| 748 |
+
lines=14,
|
| 749 |
value=load_sample_json(),
|
| 750 |
+
placeholder='{"revenue": 1000000, "costs": 600000}',
|
| 751 |
+
info="Enter your business metrics in JSON"
|
| 752 |
)
|
| 753 |
kpi_metrics = gr.CheckboxGroup(
|
| 754 |
["revenue", "growth", "efficiency", "customer", "operational"],
|
| 755 |
+
label="π Metrics to Calculate",
|
| 756 |
+
value=["revenue", "growth", "efficiency"],
|
| 757 |
+
info="Select which KPI categories to generate"
|
| 758 |
+
)
|
| 759 |
+
kpi_btn = gr.Button(
|
| 760 |
+
"π Generate KPIs",
|
| 761 |
+
variant="primary",
|
| 762 |
+
size="lg",
|
| 763 |
+
elem_classes=["primary-btn"]
|
| 764 |
)
|
| 765 |
+
gr.Markdown("""
|
| 766 |
+
**π‘ Generates:**
|
| 767 |
+
- Revenue metrics
|
| 768 |
+
- Growth rates
|
| 769 |
+
- Efficiency ratios
|
| 770 |
+
- Customer metrics
|
| 771 |
+
- Operational KPIs
|
| 772 |
+
- Executive summary
|
| 773 |
+
""")
|
| 774 |
|
| 775 |
+
with gr.Column(scale=2):
|
| 776 |
+
kpi_output = gr.Textbox(
|
| 777 |
+
label="π KPI Report",
|
| 778 |
+
lines=25,
|
| 779 |
+
elem_classes=["output-class"]
|
| 780 |
+
)
|
| 781 |
|
| 782 |
kpi_btn.click(
|
| 783 |
tool_kpi_generator,
|
| 784 |
inputs=[kpi_json, kpi_metrics],
|
| 785 |
outputs=[kpi_output]
|
| 786 |
)
|
| 787 |
+
|
| 788 |
+
gr.Markdown("*π‘ Sample business data is already loaded! Just click 'Generate KPIs' to see results.*")
|
| 789 |
|
| 790 |
# Footer
|
| 791 |
+
gr.HTML("""
|
| 792 |
+
<div class="footer">
|
| 793 |
+
<h2 style="margin-bottom: 20px;">π― About MissionControlMCP</h2>
|
| 794 |
+
|
| 795 |
+
<p style="font-size: 18px; margin-bottom: 20px;">
|
| 796 |
+
<strong>8 enterprise-grade automation tools</strong> integrated with Claude Desktop via Model Context Protocol (MCP)
|
| 797 |
+
</p>
|
| 798 |
+
|
| 799 |
+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin: 30px 0;">
|
| 800 |
+
<div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
|
| 801 |
+
<strong>π PDF Reader</strong><br/>
|
| 802 |
+
<small>Extract text from documents</small>
|
| 803 |
+
</div>
|
| 804 |
+
<div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
|
| 805 |
+
<strong>π Text Extractor</strong><br/>
|
| 806 |
+
<small>Keywords & summaries</small>
|
| 807 |
+
</div>
|
| 808 |
+
<div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
|
| 809 |
+
<strong>π Web Fetcher</strong><br/>
|
| 810 |
+
<small>Scrape websites</small>
|
| 811 |
+
</div>
|
| 812 |
+
<div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
|
| 813 |
+
<strong>π RAG Search</strong><br/>
|
| 814 |
+
<small>Semantic search</small>
|
| 815 |
+
</div>
|
| 816 |
+
<div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
|
| 817 |
+
<strong>π Data Visualizer</strong><br/>
|
| 818 |
+
<small>Create charts</small>
|
| 819 |
+
</div>
|
| 820 |
+
<div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
|
| 821 |
+
<strong>π File Converter</strong><br/>
|
| 822 |
+
<small>Format conversions</small>
|
| 823 |
+
</div>
|
| 824 |
+
<div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
|
| 825 |
+
<strong>π§ Email Classifier</strong><br/>
|
| 826 |
+
<small>Intent detection</small>
|
| 827 |
+
</div>
|
| 828 |
+
<div style="padding: 15px; background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
|
| 829 |
+
<strong>π KPI Generator</strong><br/>
|
| 830 |
+
<small>Business analytics</small>
|
| 831 |
+
</div>
|
| 832 |
+
</div>
|
| 833 |
+
|
| 834 |
+
<div style="margin-top: 30px; padding-top: 20px; border-top: 2px solid #e9ecef;">
|
| 835 |
+
<p style="font-size: 16px; margin: 10px 0;">
|
| 836 |
+
π <a href="https://github.com/AlBaraa-1/CleanEye-Hackathon" target="_blank" style="color: #667eea; text-decoration: none; font-weight: 600;">View on GitHub</a>
|
| 837 |
+
</p>
|
| 838 |
+
<p style="margin: 10px 0; color: #6c757d;">
|
| 839 |
+
π Built for HuggingFace Gradio x BuildWithMCP Hackathon
|
| 840 |
+
</p>
|
| 841 |
+
<p style="margin: 10px 0; color: #6c757d;">
|
| 842 |
+
Made with β€οΈ using Python, Gradio, Claude MCP, FAISS, and Sentence Transformers
|
| 843 |
+
</p>
|
| 844 |
+
</div>
|
| 845 |
+
</div>
|
| 846 |
""")
|
| 847 |
|
| 848 |
|