lgaleana commited on
Commit
3ce6c94
1 Parent(s): 4c925d3

Fix gen code

Browse files
Files changed (1) hide show
  1. components.py +7 -2
components.py CHANGED
@@ -132,7 +132,7 @@ class CodeTask(TaskComponent):
132
  error_message = gr.HighlightedText(value=None, visible=False)
133
 
134
  self.input = gr.Textbox(
135
- label="Input to the code",
136
  interactive=True,
137
  )
138
  with gr.Column():
@@ -219,10 +219,11 @@ class CodeTask(TaskComponent):
219
  error_message = gr.HighlightedText.update(
220
  value=[(str(e), "ERROR")], visible=True
221
  )
 
222
  return (
223
  raw_prompt_output,
224
  packages,
225
- function,
226
  error_message,
227
  accordion,
228
  )
@@ -244,6 +245,10 @@ class CodeTask(TaskComponent):
244
  self._toolkit_func = list(locals().items())[-1][1]
245
 
246
  formatted_input = input.format(**vars_in_scope)
 
 
 
 
247
  return self._toolkit_func(formatted_input)
248
 
249
 
 
132
  error_message = gr.HighlightedText(value=None, visible=False)
133
 
134
  self.input = gr.Textbox(
135
+ label="Input",
136
  interactive=True,
137
  )
138
  with gr.Column():
 
219
  error_message = gr.HighlightedText.update(
220
  value=[(str(e), "ERROR")], visible=True
221
  )
222
+ accordion = gr.Accordion.update(open=True)
223
  return (
224
  raw_prompt_output,
225
  packages,
226
+ function.replace("```python", "").replace("```", ""),
227
  error_message,
228
  accordion,
229
  )
 
245
  self._toolkit_func = list(locals().items())[-1][1]
246
 
247
  formatted_input = input.format(**vars_in_scope)
248
+ try:
249
+ formatted_input = eval(formatted_input)
250
+ except:
251
+ pass
252
  return self._toolkit_func(formatted_input)
253
 
254