JawadBenali commited on
Commit
eab4832
Β·
1 Parent(s): d951139

Initial deployment - ArchitectAI MCP

Browse files
Files changed (1) hide show
  1. app.py +26 -15
app.py CHANGED
@@ -584,24 +584,30 @@ with gr.Blocks(
584
  with gr.Tab("☁️ Safe Refactoring (Modal)", id=3):
585
  gr.Markdown("""
586
  ### Production-Safe Cloud Execution
587
- Refactor code in isolated Modal sandboxes with automatic testing.
588
  """)
589
 
590
  gr.HTML("""
591
  <div class="info-card">
592
- <strong>πŸ›‘οΈ Safety Guaranteed:</strong> All changes run in isolated cloud containers.
593
- Your local files are updated ONLY if tests pass. Zero risk to production code.
594
  </div>
595
  """)
596
 
597
  with gr.Row():
598
  with gr.Column():
599
- gr.Markdown("#### πŸ“ Target Configuration")
 
 
 
 
 
 
600
 
601
  file_input = gr.Textbox(
602
  label="Target File (Relative Path)",
603
  placeholder="services/payment_processor.py",
604
- info="File to refactor, relative to project root",
605
  lines=1
606
  )
607
 
@@ -614,8 +620,8 @@ with gr.Blocks(
614
 
615
  instruction_input = gr.Textbox(
616
  label="Refactoring Instructions",
617
- placeholder="Extract Strategy pattern for payment methods. Create PaymentStrategy interface and separate classes for CreditCard, PayPal, Bitcoin...",
618
- info="Detailed instructions for the AI",
619
  lines=5
620
  )
621
 
@@ -631,7 +637,7 @@ with gr.Blocks(
631
 
632
  modal_output = gr.Markdown(
633
  label="Cloud Execution Logs",
634
- value="Waiting for execution...",
635
  elem_classes=["code-block"]
636
  )
637
 
@@ -639,20 +645,25 @@ with gr.Blocks(
639
  <div style="margin-top: 1rem; padding: 1rem; background: #f8f9fa; border-radius: 8px;">
640
  <strong>How it works:</strong>
641
  <ol style="margin: 0.5rem 0;">
642
- <li>Code is sent to Modal cloud</li>
643
- <li>Executed in isolated container</li>
 
644
  <li>Tests run automatically</li>
645
- <li>Results returned safely</li>
646
  </ol>
647
  </div>
648
  """)
 
 
 
 
 
649
 
650
  execute_btn.click(
651
- fn=run_modal_refactoring,
652
- inputs=[file_input, instruction_input, test_input],
653
- outputs=modal_output
654
  )
655
-
656
  # FOOTER
657
  gr.HTML("""
658
  <div style="text-align: center; margin-top: 2rem; padding: 1rem; border-top: 1px solid #e9ecef;">
 
584
  with gr.Tab("☁️ Safe Refactoring (Modal)", id=3):
585
  gr.Markdown("""
586
  ### Production-Safe Cloud Execution
587
+ Upload your project, specify which file to refactor, and let Modal handle it safely.
588
  """)
589
 
590
  gr.HTML("""
591
  <div class="info-card">
592
+ <strong>πŸ›‘οΈ Safety Guaranteed:</strong> All changes run in isolated Modal containers.
593
+ Tests are executed in the cloud. Files updated only if tests pass.
594
  </div>
595
  """)
596
 
597
  with gr.Row():
598
  with gr.Column():
599
+ gr.Markdown("#### πŸ“ Upload & Configure")
600
+
601
+ modal_zip = gr.File(
602
+ label="πŸ“¦ Upload Project (ZIP)",
603
+ file_types=[".zip"],
604
+ type="filepath"
605
+ )
606
 
607
  file_input = gr.Textbox(
608
  label="Target File (Relative Path)",
609
  placeholder="services/payment_processor.py",
610
+ info="File to refactor, relative to ZIP root",
611
  lines=1
612
  )
613
 
 
620
 
621
  instruction_input = gr.Textbox(
622
  label="Refactoring Instructions",
623
+ placeholder="Extract Strategy pattern for payment methods...",
624
+ info="Detailed instructions for AI",
625
  lines=5
626
  )
627
 
 
637
 
638
  modal_output = gr.Markdown(
639
  label="Cloud Execution Logs",
640
+ value="☁️ Waiting for execution...",
641
  elem_classes=["code-block"]
642
  )
643
 
 
645
  <div style="margin-top: 1rem; padding: 1rem; background: #f8f9fa; border-radius: 8px;">
646
  <strong>How it works:</strong>
647
  <ol style="margin: 0.5rem 0;">
648
+ <li>Upload your project as ZIP</li>
649
+ <li>Specify file to refactor</li>
650
+ <li>Modal extracts & executes in cloud</li>
651
  <li>Tests run automatically</li>
652
+ <li>Download refactored ZIP</li>
653
  </ol>
654
  </div>
655
  """)
656
+
657
+ download_output = gr.File(
658
+ label="πŸ“₯ Download Refactored Project",
659
+ visible=False
660
+ )
661
 
662
  execute_btn.click(
663
+ fn=run_modal_refactoring_zip,
664
+ inputs=[modal_zip, file_input, instruction_input, test_input],
665
+ outputs=[modal_output, download_output]
666
  )
 
667
  # FOOTER
668
  gr.HTML("""
669
  <div style="text-align: center; margin-top: 2rem; padding: 1rem; border-top: 1px solid #e9ecef;">