C2MV commited on
Commit
67e3976
1 Parent(s): 15a2bb8

Update UI.py

Browse files
Files changed (1) hide show
  1. UI.py +26 -25
UI.py CHANGED
@@ -1,12 +1,13 @@
1
  # UI.py
2
 
3
  import gradio as gr
 
4
 
5
- def create_interface(process_and_plot):
6
  with gr.Blocks() as demo:
7
- gr.Markdown("# Bioprocess Modeling Application with Yi-Coder Integration")
8
 
9
- file_input = gr.File(label="Upload Excel File")
10
 
11
  MAX_EQUATIONS = 3
12
  biomass_equations = []
@@ -21,60 +22,60 @@ def create_interface(process_and_plot):
21
 
22
  def create_model_inputs(model_name, equations_list, params_list, bounds_list):
23
  with gr.Column():
24
- gr.Markdown(f"### {model_name} Models")
25
  for i in range(MAX_EQUATIONS):
26
  with gr.Row(visible=(i == 0)) as row:
27
  equation_input = gr.Textbox(
28
- label=f"{model_name} Model {i+1} Equation",
29
- placeholder="Enter equation in terms of t and parameters",
30
  lines=1,
31
- value="" if i > 0 else "Predefined equation"
32
  )
33
  params_input = gr.Textbox(
34
- label=f"{model_name} Model {i+1} Parameters",
35
- placeholder="Comma-separated parameters",
36
  lines=1,
37
- value="" if i > 0 else "Parameters"
38
  )
39
  bounds_input = gr.Textbox(
40
- label=f"{model_name} Model {i+1} Bounds",
41
- placeholder="(lower, upper) for each parameter",
42
  lines=1
43
  )
44
  equations_list.append((row, equation_input))
45
  params_list.append(params_input)
46
  bounds_list.append(bounds_input)
47
- add_btn = gr.Button(f"Add {model_name} Equation")
48
- remove_btn = gr.Button(f"Remove {model_name} Equation")
49
  return add_btn, remove_btn
50
 
51
- with gr.Accordion("Model Definitions", open=True):
52
  with gr.Row():
53
  with gr.Column():
54
  add_biomass_btn, remove_biomass_btn = create_model_inputs(
55
- "Biomass", biomass_equations, biomass_params, biomass_bounds
56
  )
57
  with gr.Column():
58
  add_substrate_btn, remove_substrate_btn = create_model_inputs(
59
- "Substrate", substrate_equations, substrate_params, substrate_bounds
60
  )
61
  with gr.Column():
62
  add_product_btn, remove_product_btn = create_model_inputs(
63
- "Product", product_equations, product_params, product_bounds
64
  )
65
 
66
  legend_position = gr.Radio(
67
  choices=["upper left", "upper right", "lower left", "lower right", "best"],
68
- label="Legend Position",
69
  value="best"
70
  )
71
- show_legend = gr.Checkbox(label="Show Legend", value=True)
72
- show_params = gr.Checkbox(label="Show Parameters", value=True)
73
- simulate_btn = gr.Button("Simulate")
74
 
75
  with gr.Row():
76
- output_gallery = gr.Gallery(label="Results", columns=2, height='auto')
77
- analysis_output = gr.Textbox(label="Yi-Coder Analysis", lines=15)
78
 
79
  biomass_eq_count = gr.Number(value=1, visible=False)
80
  substrate_eq_count = gr.Number(value=1, visible=False)
@@ -150,4 +151,4 @@ def create_interface(process_and_plot):
150
  outputs=[output_gallery, analysis_output]
151
  )
152
 
153
- return demo # Make sure to return the demo object here
 
1
  # UI.py
2
 
3
  import gradio as gr
4
+ from interface import process_and_plot
5
 
6
+ def create_interface():
7
  with gr.Blocks() as demo:
8
+ gr.Markdown("# Aplicación de Modelado de Bioprocesos con Integración de Yi-Coder")
9
 
10
+ file_input = gr.File(label="Subir Archivo Excel")
11
 
12
  MAX_EQUATIONS = 3
13
  biomass_equations = []
 
22
 
23
  def create_model_inputs(model_name, equations_list, params_list, bounds_list):
24
  with gr.Column():
25
+ gr.Markdown(f"### Modelos de {model_name}")
26
  for i in range(MAX_EQUATIONS):
27
  with gr.Row(visible=(i == 0)) as row:
28
  equation_input = gr.Textbox(
29
+ label=f"Ecuación del Modelo {model_name} {i+1}",
30
+ placeholder="Introduce la ecuación en términos de t y parámetros",
31
  lines=1,
32
+ value="" if i > 0 else "Ecuación por defecto"
33
  )
34
  params_input = gr.Textbox(
35
+ label=f"Parámetros del Modelo {model_name} {i+1}",
36
+ placeholder="Parámetros separados por comas",
37
  lines=1,
38
+ value="" if i > 0 else "Parámetros"
39
  )
40
  bounds_input = gr.Textbox(
41
+ label=f"Limites del Modelo {model_name} {i+1}",
42
+ placeholder="(inferior, superior) para cada parámetro",
43
  lines=1
44
  )
45
  equations_list.append((row, equation_input))
46
  params_list.append(params_input)
47
  bounds_list.append(bounds_input)
48
+ add_btn = gr.Button(f"Agregar Ecuación de {model_name}")
49
+ remove_btn = gr.Button(f"Eliminar Ecuación de {model_name}")
50
  return add_btn, remove_btn
51
 
52
+ with gr.Accordion("Definición de Modelos", open=True):
53
  with gr.Row():
54
  with gr.Column():
55
  add_biomass_btn, remove_biomass_btn = create_model_inputs(
56
+ "Biomasa", biomass_equations, biomass_params, biomass_bounds
57
  )
58
  with gr.Column():
59
  add_substrate_btn, remove_substrate_btn = create_model_inputs(
60
+ "Sustrato", substrate_equations, substrate_params, substrate_bounds
61
  )
62
  with gr.Column():
63
  add_product_btn, remove_product_btn = create_model_inputs(
64
+ "Producto", product_equations, product_params, product_bounds
65
  )
66
 
67
  legend_position = gr.Radio(
68
  choices=["upper left", "upper right", "lower left", "lower right", "best"],
69
+ label="Posición de la Leyenda",
70
  value="best"
71
  )
72
+ show_legend = gr.Checkbox(label="Mostrar Leyenda", value=True)
73
+ show_params = gr.Checkbox(label="Mostrar Parámetros", value=True)
74
+ simulate_btn = gr.Button("Simular")
75
 
76
  with gr.Row():
77
+ output_gallery = gr.Gallery(label="Resultados", columns=2, height='auto')
78
+ analysis_output = gr.Textbox(label="Análisis de Yi-Coder", lines=15)
79
 
80
  biomass_eq_count = gr.Number(value=1, visible=False)
81
  substrate_eq_count = gr.Number(value=1, visible=False)
 
151
  outputs=[output_gallery, analysis_output]
152
  )
153
 
154
+ return demo