Spaces:
Running
Running
File size: 1,500 Bytes
728a6ed 5bd77b5 8bb6bcc 7f1aca2 b4db5b8 7f1aca2 731de2f 7b64b2c 8bb6bcc 731de2f 5da936b 7d34933 7b64b2c 7d34933 9def5da 7f1aca2 8e651c3 b08763f 5109428 8e651c3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# https://github.com/google-research/tensorflow-coder/blob/master/tf_coder/tf_coder_main.py
import streamlit as st
from tf_coder.value_search import colab_interface, value_search_settings
import io
from contextlib import redirect_stdout
st.set_page_config(page_icon='π©βπ»', layout="wide")
inputs = st.text_area('The input tensor(s) specified as key-value pairs', placeholder="{'rows': [10, 20, 30],'cols': [1,2,3,4]}")
st.sidebar.header("Settings:")
settings_kwargs = dict()
settings_kwargs["require_all_inputs_used"] = st.sidebar.checkbox("Require All Inputs", value=True)
settings_kwargs["max_solutions"] = st.sidebar.slider("Maximum number of solutions", value=1, min_value=1, step=1, max_value=10)
settings = value_search_settings.from_dict({
'timeout': 300,
'only_minimal_solutions': False,
'max_solutions': settings_kwargs["max_solutions"],
'require_all_inputs_used': settings_kwargs["require_all_inputs_used"],
'require_one_input_used': not settings_kwargs["require_all_inputs_used"],
})
with io.StringIO() as buf, redirect_stdout(buf):
output = [[11, 12, 13, 14],
[21, 22, 23, 24],
[31, 32, 33, 34]]
constants = []
description = 'add two vectors with broadcasting to get a matrix'
inputs = {'rows': [10, 20, 30],'cols': [1,2,3,4]}
results = colab_interface.run_value_search_from_colab(inputs, output, constants, description, settings)
stdout = buf.getvalue()
st.code(stdout, language='bash') |