vsj0702 commited on
Commit
f6d50ca
·
verified ·
1 Parent(s): d03852c

Fixing bug

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -86,15 +86,12 @@ with col1:
86
  else:
87
  exec_code = code
88
  if input_count > 0:
89
- # Override input() to return provided values in order
 
90
  stub = (
91
- "import builtins
92
  "
93
- f"vals = iter([{', '.join(repr(v) for v in inputs)}])
94
- "
95
- "builtins.input = lambda prompt='': next(vals)
96
- "
97
- ) for v in inputs)}])
98
  "
99
  "builtins.input = lambda prompt='': next(vals)
100
  "
@@ -105,7 +102,7 @@ with col1:
105
  st.session_state.code_output = out
106
  st.session_state.error_output = err or exc
107
 
108
- # 9️⃣ Display output and errors
109
  if st.session_state.get("code_output"):
110
  st.text_area("Output", st.session_state.code_output, height=120)
111
  if st.session_state.get("error_output"):
 
86
  else:
87
  exec_code = code
88
  if input_count > 0:
89
+ # Override builtins.input to return provided values in order
90
+ vals_list = [repr(v) for v in inputs]
91
  stub = (
92
+ "import builtins
93
  "
94
+ f"vals = iter([{', '.join(vals_list)}])
 
 
 
 
95
  "
96
  "builtins.input = lambda prompt='': next(vals)
97
  "
 
102
  st.session_state.code_output = out
103
  st.session_state.error_output = err or exc
104
 
105
+ # 9️⃣ Display output and errors and errors
106
  if st.session_state.get("code_output"):
107
  st.text_area("Output", st.session_state.code_output, height=120)
108
  if st.session_state.get("error_output"):