lgaleana commited on
Commit
31918dc
1 Parent(s): 71586bc

NIT for errors

Browse files
Files changed (2) hide show
  1. actions.py +2 -2
  2. components.py +1 -0
actions.py CHANGED
@@ -41,7 +41,7 @@ def execute_task(task_id: int, active_index: int, error_value, *args):
41
  # We need to return outputs for all tasks in the row.
42
  outputs = [""] * n_avail_tasks
43
 
44
- if active_index is None: # Active index could be 0 == not active_index
45
  return outputs + [
46
  gr.HighlightedText.update(
47
  value=error_value, visible=error_value is not None
@@ -108,7 +108,7 @@ def execute_task(task_id: int, active_index: int, error_value, *args):
108
  )
109
  ]
110
  except Exception as e:
111
- raise e
112
  return outputs + [
113
  gr.HighlightedText.update(
114
  value=[(f"Error in Task {task_id} :: {e}", "ERROR")],
 
41
  # We need to return outputs for all tasks in the row.
42
  outputs = [""] * n_avail_tasks
43
 
44
+ if active_index is None or error_value: # Active index could be 0 == not active_index
45
  return outputs + [
46
  gr.HighlightedText.update(
47
  value=error_value, visible=error_value is not None
 
108
  )
109
  ]
110
  except Exception as e:
111
+ outputs[active_index] = "ERROR"
112
  return outputs + [
113
  gr.HighlightedText.update(
114
  value=[(f"Error in Task {task_id} :: {e}", "ERROR")],
components.py CHANGED
@@ -237,6 +237,7 @@ class CodeTask(TaskComponent):
237
  subprocess.check_call([sys.executable, "-m", "pip", "install", p])
238
  __import__(p)
239
  exec(function, locals())
 
240
  self._toolkit_func = list(locals().items())[-1][1]
241
 
242
  formatted_input = input.format(**vars_in_scope)
 
237
  subprocess.check_call([sys.executable, "-m", "pip", "install", p])
238
  __import__(p)
239
  exec(function, locals())
240
+ # Should be last function in scope
241
  self._toolkit_func = list(locals().items())[-1][1]
242
 
243
  formatted_input = input.format(**vars_in_scope)