lgaleana commited on
Commit
0d8cdc8
1 Parent(s): 31918dc

NIT for accordion

Browse files
Files changed (1) hide show
  1. components.py +6 -2
components.py CHANGED
@@ -115,7 +115,7 @@ class CodeTask(TaskComponent):
115
  generate_code = gr.Button("Generate code")
116
  with gr.Row():
117
  with gr.Column():
118
- with gr.Accordion(label="Generated code", open=False):
119
  raw_prompt_output = gr.Textbox(
120
  label="Raw output",
121
  lines=5,
@@ -151,6 +151,7 @@ class CodeTask(TaskComponent):
151
  self.packages,
152
  self.function,
153
  error_message,
 
154
  ],
155
  )
156
 
@@ -162,6 +163,7 @@ class CodeTask(TaskComponent):
162
  packages = ""
163
  function = ""
164
  error_message = gr.HighlightedText.update(None, visible=False)
 
165
 
166
  if not code_prompt:
167
  return (
@@ -169,6 +171,7 @@ class CodeTask(TaskComponent):
169
  packages,
170
  function,
171
  error_message,
 
172
  )
173
 
174
  print(f"Generating code.")
@@ -201,7 +204,7 @@ class CodeTask(TaskComponent):
201
  The following text should have a python function with some imports that might need to be installed:
202
  {raw_prompt_output}
203
 
204
- Extract all the python packages, nothing else. Print them in a single python list that can be used with eval().
205
  """,
206
  f"""
207
  The following text should have a python function and some imports:
@@ -221,6 +224,7 @@ class CodeTask(TaskComponent):
221
  packages,
222
  function,
223
  error_message,
 
224
  )
225
 
226
  @property
 
115
  generate_code = gr.Button("Generate code")
116
  with gr.Row():
117
  with gr.Column():
118
+ with gr.Accordion(label="Generated code", open=False) as accordion:
119
  raw_prompt_output = gr.Textbox(
120
  label="Raw output",
121
  lines=5,
 
151
  self.packages,
152
  self.function,
153
  error_message,
154
+ accordion,
155
  ],
156
  )
157
 
 
163
  packages = ""
164
  function = ""
165
  error_message = gr.HighlightedText.update(None, visible=False)
166
+ accordion = gr.Accordion.update()
167
 
168
  if not code_prompt:
169
  return (
 
171
  packages,
172
  function,
173
  error_message,
174
+ accordion,
175
  )
176
 
177
  print(f"Generating code.")
 
204
  The following text should have a python function with some imports that might need to be installed:
205
  {raw_prompt_output}
206
 
207
+ Extract all the python packages and nothing else. Print them as a single python list that can be used with eval().
208
  """,
209
  f"""
210
  The following text should have a python function and some imports:
 
224
  packages,
225
  function,
226
  error_message,
227
+ accordion,
228
  )
229
 
230
  @property