davidmezzetti commited on
Commit
343c23e
1 Parent(s): 5ade8fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -365,7 +365,9 @@ class Application:
365
  elif isinstance(default, dict):
366
  default = ",".join(default.keys())
367
 
368
- return st.text_input(label, value=default, key=component + name, disabled=True)
 
 
369
 
370
  def number(self, label, component, config, name, default=None):
371
  """
@@ -401,7 +403,10 @@ class Application:
401
  """
402
 
403
  default = self.setting(config, name, default)
404
- return st.checkbox(label, value=default, key=component + name, disabled=True)
 
 
 
405
 
406
  def select(self, label, component, config, name, options, default=0):
407
  """
@@ -425,7 +430,9 @@ class Application:
425
  # Derive default index
426
  default = index[0] if index else default
427
 
428
- return st.selectbox(label, options, index=default, key=component + name, disabled=True)
 
 
429
 
430
  def split(self, text):
431
  """
@@ -524,6 +531,8 @@ class Application:
524
  st.markdown("**Translate** \n*Machine translation*")
525
  options["target"] = self.text("Target language code", component, config, "args", "en")
526
 
 
 
527
  return options
528
 
529
  def yaml(self, components):
@@ -646,13 +655,15 @@ class Application:
646
  # Run search
647
  if process.embeddings:
648
  process.search(self.query(workflow))
 
 
 
649
 
650
  def run(self):
651
  """
652
  Runs Streamlit application.
653
  """
654
 
655
- # Load configuration
656
  with st.sidebar:
657
  st.image("https://github.com/neuml/txtai/raw/master/logo.png", width=256)
658
  st.markdown("# Workflow builder \n*Build and apply workflows to data* ")
 
365
  elif isinstance(default, dict):
366
  default = ",".join(default.keys())
367
 
368
+ st.caption(label)
369
+ st.code(default, language="yaml")
370
+ return default
371
 
372
  def number(self, label, component, config, name, default=None):
373
  """
 
403
  """
404
 
405
  default = self.setting(config, name, default)
406
+
407
+ st.caption(label)
408
+ st.code(default=="True", language="yaml")
409
+ return default == "True"
410
 
411
  def select(self, label, component, config, name, options, default=0):
412
  """
 
430
  # Derive default index
431
  default = index[0] if index else default
432
 
433
+ st.caption(label)
434
+ st.code(options[default], language="yaml")
435
+ return options[default]
436
 
437
  def split(self, text):
438
  """
 
531
  st.markdown("**Translate** \n*Machine translation*")
532
  options["target"] = self.text("Target language code", component, config, "args", "en")
533
 
534
+ st.markdown("---")
535
+
536
  return options
537
 
538
  def yaml(self, components):
 
655
  # Run search
656
  if process.embeddings:
657
  process.search(self.query(workflow))
658
+ else:
659
+ # Clear session query
660
+ st.session_state["query"] = None
661
 
662
  def run(self):
663
  """
664
  Runs Streamlit application.
665
  """
666
 
 
667
  with st.sidebar:
668
  st.image("https://github.com/neuml/txtai/raw/master/logo.png", width=256)
669
  st.markdown("# Workflow builder \n*Build and apply workflows to data* ")