acecalisto3 commited on
Commit
4a21115
·
verified ·
1 Parent(s): dc48860

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +154 -154
app.py CHANGED
@@ -398,160 +398,160 @@ def create_interface():
398
  return None, f"Error: {str(e)}", ""
399
 
400
  def create_interface():
401
- """Create a comprehensive Gradio interface with advanced features and styling"""
402
-
403
- css = """
404
- body {
405
- background-color: #0c0c0c;
406
- color: #ffffff;
407
- font-family: 'Roboto', sans-serif;
408
- }
409
- .container {
410
- max-width: 1200px;
411
- margin: auto;
412
- border-radius: 10px;
413
- padding: 20px;
414
- box-shadow: 0 0 30px rgba(0, 255, 0, 0.5);
415
- background: linear-gradient(180deg, rgba(0, 255, 0, 0.1), rgba(255, 165, 0, 0.1));
416
- }
417
- h1 {
418
- color: #00ff00;
419
- text-align: center;
420
- }
421
- h2, h3, h4 {
422
- color: #ff7f50;
423
- }
424
- .tab {
425
- background-color: #1d1d1d;
426
- border: 1px solid #00ff00;
427
- border-radius: 5px;
428
- margin-bottom: 10px;
429
- padding: 10px;
430
- }
431
- .tab:hover {
432
- background-color: rgba(0, 255, 0, 0.2);
433
- }
434
- .warning {
435
- background-color: rgba(255, 255, 0, 0.2);
436
- color: #856404;
437
- }
438
- .error {
439
- background-color: rgba(255, 0, 0, 0.3);
440
- color: #721c24;
441
- }
442
- input[type="text"], input[type="file"] {
443
- border: 2px solid #00ff00;
444
- border-radius: 5px;
445
- padding: 10px;
446
- background-color: #1d1d1d;
447
- color: #ffffff;
448
- }
449
- input[type="text"]:focus, input[type="file"]:focus {
450
- border-color: #ff7f50;
451
- outline: none;
452
- }
453
- .btn-primary {
454
- background-color: #00ff00;
455
- border: none;
456
- border-radius: 5px;
457
- padding: 10px 20px;
458
- cursor: pointer;
459
- transition: background-color 0.3s;
460
- }
461
- .btn-secondary {
462
- background-color: #ff7f50;
463
- border: none;
464
- border-radius: 5px;
465
- padding: 10px 20px;
466
- cursor: pointer;
467
- transition: background-color 0.3s;
468
- }
469
- .btn-primary:hover, .btn-secondary:hover {
470
- background-color: rgba(255, 165, 0, 0.8);
471
- }
472
- textarea {
473
- border: 2px solid #00ff00;
474
- border-radius: 5px;
475
- padding: 10px;
476
- background-color: #1d1d1d;
477
- color: #ffffff;
478
- }
479
- textarea:focus {
480
- border-color: #ff7f50;
481
- outline: none;
482
- }
483
- .output-box {
484
- background-color: #1d1d1d;
485
- border: 1px solid #00ff00;
486
- border-radius: 5px;
487
- padding: 10px;
488
- overflow-x: auto;
489
- }
490
- """
491
-
492
- with gr.Blocks(css=css, title="Advanced Text & URL Processor") as interface:
493
- gr.Markdown("# 🌐 Advanced URL & Text Processing Toolkit")
494
-
495
- with gr.Tab("URL Processing"):
496
- url_input = gr.Textbox(
497
- label="Enter URLs (comma or newline separated)",
498
- lines=5,
499
- placeholder="https://example1.com\nhttps://example2.com",
500
- interactive=True,
501
- elem_id="url-input"
502
- )
503
-
504
- with gr.Tab("File Input"):
505
- file_input = gr.File(
506
- label="Upload text file or ZIP archive",
507
- file_types=[".txt", ".zip", ".md", ".csv", ".json", ".xml"]
508
- )
509
-
510
- with gr.Tab("Text Input"):
511
- text_input = gr.Textbox(
512
- label="Raw Text Input",
513
- lines=5,
514
- placeholder="Paste your text here...",
515
- interactive=True
516
- )
517
-
518
- with gr.Tab("JSON Editor"):
519
- json_editor = gr.Textbox(
520
- label="JSON Editor",
521
- lines=20,
522
- placeholder="View and edit your JSON data here...",
523
- interactive=True,
524
- elem_id="json-editor"
525
- )
526
-
527
- with gr.Tab("Scratchpad"):
528
- scratchpad = gr.Textbox(
529
- label="Scratchpad",
530
- lines=10,
531
- placeholder="Quick notes or text collections...",
532
- interactive=True
533
- )
534
-
535
- process_btn = gr.Button("Process Input", variant="primary")
536
- qr_btn = gr.Button("Generate QR Code", variant="secondary")
537
-
538
- output_text = gr.Textbox(label="Processing Results", interactive=False, elem_id="output-text")
539
- output_file = gr.File(label="Processed Output")
540
- qr_output = gr.Image(label="QR Code", type="filepath") # To display the generated QR code
541
-
542
- # The rest of the internal logic remains unchanged
543
-
544
- gr.Markdown("""
545
- ### Usage Guidelines
546
- - **URL Processing**: Enter valid HTTP/HTTPS URLs
547
- - **File Input**: Upload text files or ZIP archives
548
- - **Text Input**: Direct text processing
549
- - **JSON Editor**: View and edit your JSON data
550
- - **Scratchpad**: Quick notes or text collections
551
- - Advanced cleaning and validation included
552
- """)
553
-
554
- return interface
555
 
556
  def main():
557
  # Configure system settings
 
398
  return None, f"Error: {str(e)}", ""
399
 
400
  def create_interface():
401
+ """Create a comprehensive Gradio interface with advanced features and styling"""
402
+
403
+ css = """
404
+ body {
405
+ background-color: #0c0c0c;
406
+ color: #ffffff;
407
+ font-family: 'Roboto', sans-serif;
408
+ }
409
+ .container {
410
+ max-width: 1200px;
411
+ margin: auto;
412
+ border-radius: 10px;
413
+ padding: 20px;
414
+ box-shadow: 0 0 30px rgba(0, 255, 0, 0.5);
415
+ background: linear-gradient(180deg, rgba(0, 255, 0, 0.1), rgba(255, 165, 0, 0.1));
416
+ }
417
+ h1 {
418
+ color: #00ff00;
419
+ text-align: center;
420
+ }
421
+ h2, h3, h4 {
422
+ color: #ff7f50;
423
+ }
424
+ .tab {
425
+ background-color: #1d1d1d;
426
+ border: 1px solid #00ff00;
427
+ border-radius: 5px;
428
+ margin-bottom: 10px;
429
+ padding: 10px;
430
+ }
431
+ .tab:hover {
432
+ background-color: rgba(0, 255, 0, 0.2);
433
+ }
434
+ .warning {
435
+ background-color: rgba(255, 255, 0, 0.2);
436
+ color: #856404;
437
+ }
438
+ .error {
439
+ background-color: rgba(255, 0, 0, 0.3);
440
+ color: #721c24;
441
+ }
442
+ input[type="text"], input[type="file"] {
443
+ border: 2px solid #00ff00;
444
+ border-radius: 5px;
445
+ padding: 10px;
446
+ background-color: #1d1d1d;
447
+ color: #ffffff;
448
+ }
449
+ input[type="text"]:focus, input[type="file"]:focus {
450
+ border-color: #ff7f50;
451
+ outline: none;
452
+ }
453
+ .btn-primary {
454
+ background-color: #00ff00;
455
+ border: none;
456
+ border-radius: 5px;
457
+ padding: 10px 20px;
458
+ cursor: pointer;
459
+ transition: background-color 0.3s;
460
+ }
461
+ .btn-secondary {
462
+ background-color: #ff7f50;
463
+ border: none;
464
+ border-radius: 5px;
465
+ padding: 10px 20px;
466
+ cursor: pointer;
467
+ transition: background-color 0.3s;
468
+ }
469
+ .btn-primary:hover, .btn-secondary:hover {
470
+ background-color: rgba(255, 165, 0, 0.8);
471
+ }
472
+ textarea {
473
+ border: 2px solid #00ff00;
474
+ border-radius: 5px;
475
+ padding: 10px;
476
+ background-color: #1d1d1d;
477
+ color: #ffffff;
478
+ }
479
+ textarea:focus {
480
+ border-color: #ff7f50;
481
+ outline: none;
482
+ }
483
+ .output-box {
484
+ background-color: #1d1d1d;
485
+ border: 1px solid #00ff00;
486
+ border-radius: 5px;
487
+ padding: 10px;
488
+ overflow-x: auto;
489
+ }
490
+ """
491
+
492
+ with gr.Blocks(css=css, title="Advanced Text & URL Processor") as interface:
493
+ gr.Markdown("# 🌐 Advanced URL & Text Processing Toolkit")
494
+
495
+ with gr.Tab("URL Processing"):
496
+ url_input = gr.Textbox(
497
+ label="Enter URLs (comma or newline separated)",
498
+ lines=5,
499
+ placeholder="https://example1.com\nhttps://example2.com",
500
+ interactive=True,
501
+ elem_id="url-input"
502
+ )
503
+
504
+ with gr.Tab("File Input"):
505
+ file_input = gr.File(
506
+ label="Upload text file or ZIP archive",
507
+ file_types=[".txt", ".zip", ".md", ".csv", ".json", ".xml"]
508
+ )
509
+
510
+ with gr.Tab("Text Input"):
511
+ text_input = gr.Textbox(
512
+ label="Raw Text Input",
513
+ lines=5,
514
+ placeholder="Paste your text here...",
515
+ interactive=True
516
+ )
517
+
518
+ with gr.Tab("JSON Editor"):
519
+ json_editor = gr.Textbox(
520
+ label="JSON Editor",
521
+ lines=20,
522
+ placeholder="View and edit your JSON data here...",
523
+ interactive=True,
524
+ elem_id="json-editor"
525
+ )
526
+
527
+ with gr.Tab("Scratchpad"):
528
+ scratchpad = gr.Textbox(
529
+ label="Scratchpad",
530
+ lines=10,
531
+ placeholder="Quick notes or text collections...",
532
+ interactive=True
533
+ )
534
+
535
+ process_btn = gr.Button("Process Input", variant="primary")
536
+ qr_btn = gr.Button("Generate QR Code", variant="secondary")
537
+
538
+ output_text = gr.Textbox(label="Processing Results", interactive=False, elem_id="output-text")
539
+ output_file = gr.File(label="Processed Output")
540
+ qr_output = gr.Image(label="QR Code", type="filepath") # To display the generated QR code
541
+
542
+ # The rest of the internal logic remains unchanged
543
+
544
+ gr.Markdown("""
545
+ ### Usage Guidelines
546
+ - **URL Processing**: Enter valid HTTP/HTTPS URLs
547
+ - **File Input**: Upload text files or ZIP archives
548
+ - **Text Input**: Direct text processing
549
+ - **JSON Editor**: View and edit your JSON data
550
+ - **Scratchpad**: Quick notes or text collections
551
+ - Advanced cleaning and validation included
552
+ """)
553
+
554
+ return interface
555
 
556
  def main():
557
  # Configure system settings