Spaces:
Runtime error
Runtime error
Timothyxxx
commited on
Commit
·
ab8d087
1
Parent(s):
1808a6e
Debug
Browse files
app.py
CHANGED
|
@@ -98,6 +98,7 @@ def generate_binder_program(_args, _generator, _data_item):
|
|
| 98 |
|
| 99 |
# Set up
|
| 100 |
import nltk
|
|
|
|
| 101 |
nltk.download('punkt')
|
| 102 |
parser = argparse.ArgumentParser()
|
| 103 |
|
|
@@ -166,10 +167,6 @@ st.markdown("Title: {}".format(title))
|
|
| 166 |
st.dataframe(df)
|
| 167 |
|
| 168 |
# Let user input the question
|
| 169 |
-
question = st.text_input(
|
| 170 |
-
"Ask a question about the table:",
|
| 171 |
-
value=EXAMPLE_TABLES[selected_table_title][1]
|
| 172 |
-
)
|
| 173 |
with col1:
|
| 174 |
selected_language = st.selectbox(
|
| 175 |
"Select a programming language",
|
|
@@ -183,7 +180,12 @@ elif selected_language == 'Python':
|
|
| 183 |
args.generate_type = 'npython'
|
| 184 |
else:
|
| 185 |
raise ValueError(f'{selected_language} language is not supported.')
|
| 186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
if not button:
|
| 188 |
st.stop()
|
| 189 |
|
|
@@ -193,7 +195,6 @@ with st.spinner("Generating program ..."):
|
|
| 193 |
binder_program = generate_binder_program(args, generator,
|
| 194 |
{"question": question, "table": db.get_table_df(), "title": title})
|
| 195 |
|
| 196 |
-
|
| 197 |
# Do execution
|
| 198 |
st.subheader("Binder program")
|
| 199 |
if selected_language == 'SQL':
|
|
@@ -222,7 +223,7 @@ try:
|
|
| 222 |
for i, step in enumerate(steps):
|
| 223 |
col1, _, _ = st.columns([4.7, 0.6, 4.7])
|
| 224 |
with col1:
|
| 225 |
-
st.markdown(f'**Step#{i+1}**')
|
| 226 |
col1, col2, col3 = st.columns([4.7, 0.6, 4.7])
|
| 227 |
with col1:
|
| 228 |
st.markdown('```sql\n' + step + '\n```')
|
|
|
|
| 98 |
|
| 99 |
# Set up
|
| 100 |
import nltk
|
| 101 |
+
|
| 102 |
nltk.download('punkt')
|
| 103 |
parser = argparse.ArgumentParser()
|
| 104 |
|
|
|
|
| 167 |
st.dataframe(df)
|
| 168 |
|
| 169 |
# Let user input the question
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
with col1:
|
| 171 |
selected_language = st.selectbox(
|
| 172 |
"Select a programming language",
|
|
|
|
| 180 |
args.generate_type = 'npython'
|
| 181 |
else:
|
| 182 |
raise ValueError(f'{selected_language} language is not supported.')
|
| 183 |
+
|
| 184 |
+
question = st.text_input(
|
| 185 |
+
"Ask a question about the table:",
|
| 186 |
+
value=EXAMPLE_TABLES[selected_table_title][1]
|
| 187 |
+
)
|
| 188 |
+
button = st.button("Run! Generate Binder program to solve the question.")
|
| 189 |
if not button:
|
| 190 |
st.stop()
|
| 191 |
|
|
|
|
| 195 |
binder_program = generate_binder_program(args, generator,
|
| 196 |
{"question": question, "table": db.get_table_df(), "title": title})
|
| 197 |
|
|
|
|
| 198 |
# Do execution
|
| 199 |
st.subheader("Binder program")
|
| 200 |
if selected_language == 'SQL':
|
|
|
|
| 223 |
for i, step in enumerate(steps):
|
| 224 |
col1, _, _ = st.columns([4.7, 0.6, 4.7])
|
| 225 |
with col1:
|
| 226 |
+
st.markdown(f'**Step#{i + 1}**')
|
| 227 |
col1, col2, col3 = st.columns([4.7, 0.6, 4.7])
|
| 228 |
with col1:
|
| 229 |
st.markdown('```sql\n' + step + '\n```')
|