suhasg commited on
Commit
df52407
·
1 Parent(s): 7c6e8cc

chnge to save it as text file

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -297,16 +297,19 @@ def main():
297
  json_data = condition_split(query)
298
  shielded_replaced_string = replace_with_shielding(json_data, condition_string)
299
  json_rule = form_json_rule(shielded_replaced_string)
 
 
300
  st.write("JSON Rule:")
301
- st.json(json_rule)
 
 
302
  st.download_button(
303
  label="Download JSON Rule",
304
- data=json.dumps(json_rule),
305
- file_name="json_rule.json",
306
- mime="application/json"
307
  )
308
  else:
309
  st.write("Please enter a query.")
310
-
311
  if __name__ == '__main__':
312
  main()
 
297
  json_data = condition_split(query)
298
  shielded_replaced_string = replace_with_shielding(json_data, condition_string)
299
  json_rule = form_json_rule(shielded_replaced_string)
300
+
301
+ # Print the JSON rule as plain text
302
  st.write("JSON Rule:")
303
+ st.write(json_rule)
304
+
305
+ # Add a download button for the text file
306
  st.download_button(
307
  label="Download JSON Rule",
308
+ data=str(json_rule),
309
+ file_name="json_rule.txt",
310
+ mime="text/plain"
311
  )
312
  else:
313
  st.write("Please enter a query.")
 
314
  if __name__ == '__main__':
315
  main()