wasmdashai commited on
Commit
9ea433e
·
verified ·
1 Parent(s): b5bbf60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -16
app.py CHANGED
@@ -446,17 +446,13 @@ def process_multiple_validators(model_names_str, model_structure, template_instr
446
 
447
  return files_output
448
 
 
449
  def render_outputs(model_names_str, model_structure, template_instructions):
450
  files = process_multiple_validators(model_names_str, model_structure, template_instructions)
451
- components = []
452
-
453
  for name, code in files.items():
454
- # إنشاء أكورديون لكل نتيجة
455
- accordion = gr.Accordion(f"{name}.Validator.cs", open=False)
456
- code_component = gr.Code(value=code, lines=20, label=name)
457
- components.append(accordion(code_component))
458
-
459
- return components
460
 
461
  with gr.Blocks(title="C# Validator Generator with 8 Tabs") as demo:
462
  gr.Markdown("# C# Validator & Entity Generator")
@@ -484,21 +480,16 @@ with gr.Blocks(title="C# Validator Generator with 8 Tabs") as demo:
484
  with gr.Tab("Batch Validators"):
485
  with gr.Row():
486
  with gr.Column():
487
- model_names_input = gr.Textbox(
488
- label="Model Names (comma-separated)",
489
- placeholder="e.g., User, Role, Customer"
490
- )
491
  shared_model_structure_input = gr.Textbox(label="Shared Model Structure", lines=10)
492
  shared_template_input = gr.Textbox(label="Shared Template Instructions (Optional)", lines=3)
493
  batch_generate_btn = gr.Button("Generate All")
494
-
495
  with gr.Column():
496
- dynamic_outputs = gr.Column()
497
-
498
  batch_generate_btn.click(
499
  fn=render_outputs,
500
  inputs=[model_names_input, shared_model_structure_input, shared_template_input],
501
- outputs=[dynamic_outputs],
502
  )
503
 
504
  # Tab 3 to Tab 8 placeholders for future features
 
446
 
447
  return files_output
448
 
449
+ @spaces.GPU
450
  def render_outputs(model_names_str, model_structure, template_instructions):
451
  files = process_multiple_validators(model_names_str, model_structure, template_instructions)
452
+ merged_output = ""
 
453
  for name, code in files.items():
454
+ merged_output += f"#---------------#\n// {name}.Validator.cs\n{code}\n\n"
455
+ return merged_output
 
 
 
 
456
 
457
  with gr.Blocks(title="C# Validator Generator with 8 Tabs") as demo:
458
  gr.Markdown("# C# Validator & Entity Generator")
 
480
  with gr.Tab("Batch Validators"):
481
  with gr.Row():
482
  with gr.Column():
483
+ model_names_input = gr.Textbox(label="Model Names (comma-separated)")
 
 
 
484
  shared_model_structure_input = gr.Textbox(label="Shared Model Structure", lines=10)
485
  shared_template_input = gr.Textbox(label="Shared Template Instructions (Optional)", lines=3)
486
  batch_generate_btn = gr.Button("Generate All")
 
487
  with gr.Column():
488
+ batch_code_output = gr.Code(label="All Validators Combined", lines=35)
 
489
  batch_generate_btn.click(
490
  fn=render_outputs,
491
  inputs=[model_names_input, shared_model_structure_input, shared_template_input],
492
+ outputs=[batch_code_output],
493
  )
494
 
495
  # Tab 3 to Tab 8 placeholders for future features