Spaces:
Runtime error
Runtime error
Commit
Β·
027697d
1
Parent(s):
8be4fd7
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,17 +9,14 @@ st.set_page_config(page_icon='π©βπ»', layout="wide", initial_sidebar_state
|
|
| 9 |
col1, col2, col3 = st.columns([5, 5, 3])
|
| 10 |
with col1:
|
| 11 |
st.write('### Inputs')
|
| 12 |
-
inputs = st_ace(placeholder="The input tensor(s) specified as a dictionary", value="{'rows': [10, 20, 30],\n'cols': [1,2,3,4]}", language="python", theme="solarized_dark")
|
| 13 |
with col2:
|
| 14 |
st.write('### Output')
|
| 15 |
-
output = st_ace(placeholder="The output tensor", value="[[11, 12, 13, 14],\n[21, 22, 23, 24],\n[31, 32, 33, 34]]", language="python", theme="solarized_dark")
|
| 16 |
with col3:
|
| 17 |
st.write('### Constants')
|
| 18 |
-
constants = st_ace(placeholder="Optional list of scalar constants", value="[]", language="python", theme="solarized_dark")
|
| 19 |
-
|
| 20 |
-
i = eval(inputs)
|
| 21 |
-
o = eval(output)
|
| 22 |
-
c = eval(constants)
|
| 23 |
description = st.text_input(label="Description", placeholder="An optional natural language description of the operation", value="add two vectors with broadcasting to get a matrix")
|
| 24 |
st.sidebar.header("Settings:")
|
| 25 |
settings_kwargs = dict()
|
|
@@ -36,8 +33,17 @@ settings = value_search_settings.from_dict({
|
|
| 36 |
'require_one_input_used': not settings_kwargs["require_all_inputs_used"],
|
| 37 |
})
|
| 38 |
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
col1, col2, col3 = st.columns([5, 5, 3])
|
| 10 |
with col1:
|
| 11 |
st.write('### Inputs')
|
| 12 |
+
inputs = st_ace(placeholder="The input tensor(s) specified as a dictionary", value="{'rows': [10, 20, 30],\n'cols': [1,2,3,4]}", language="python", theme="solarized_dark", auto_update=True)
|
| 13 |
with col2:
|
| 14 |
st.write('### Output')
|
| 15 |
+
output = st_ace(placeholder="The output tensor", value="[[11, 12, 13, 14],\n[21, 22, 23, 24],\n[31, 32, 33, 34]]", language="python", theme="solarized_dark", auto_update=True)
|
| 16 |
with col3:
|
| 17 |
st.write('### Constants')
|
| 18 |
+
constants = st_ace(placeholder="Optional list of scalar constants", value="[]", language="python", theme="solarized_dark", auto_update=True)
|
| 19 |
+
|
|
|
|
|
|
|
|
|
|
| 20 |
description = st.text_input(label="Description", placeholder="An optional natural language description of the operation", value="add two vectors with broadcasting to get a matrix")
|
| 21 |
st.sidebar.header("Settings:")
|
| 22 |
settings_kwargs = dict()
|
|
|
|
| 33 |
'require_one_input_used': not settings_kwargs["require_all_inputs_used"],
|
| 34 |
})
|
| 35 |
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
if any([inputs, output, constants]):
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
if st.button("Generate code!"):
|
| 42 |
+
i = eval(inputs)
|
| 43 |
+
o = eval(output)
|
| 44 |
+
c = eval(constants)
|
| 45 |
+
with st.spinner("Searching for solution..."):
|
| 46 |
+
with io.StringIO() as buf, redirect_stdout(buf):
|
| 47 |
+
results = colab_interface.run_value_search_from_colab(i, o, c, description, settings)
|
| 48 |
+
stdout = buf.getvalue()
|
| 49 |
+
st.code(stdout, language='bash')
|