code: def run_semgrex_process(
      input_txt: str,
      input_queries: str,
      client_files: List[str],
      show_window: bool,
      clicked: bool,
      pipe: Any,
      start_window: int,
      end_window: int,
      visualize_xpos: bool,
  ) -> None:
      """
      Run Semgrex search on the input text/files with input query and serve the HTML on the app.
  
      @param input_txt: Text to analyze and draw sentences from.
      @param input_queries: Semgrex queries to parse the input with.
      @param client_files: Alternative to input text, we can parse the content of files for scaled analysis.
      @param show_window: Whether or not the user wants a splice of the visualizations
      @param clicked: Whether or not the button has been clicked to run Semgrex search
      @param pipe: NLP pipeline to process input with
      @param start_window: If displaying a splice of visualizations, this is the start idx
      @param end_window: If displaying a splice of visualizations, this is the end idx
      @param visualize_xpos: Set to true if using xpos tags for part of speech labels, otherwise use upos tags
  
      """
  
      if clicked:
          if not input_txt and not client_files:
              st.error(
                  "Please provide a text input or upload files for analysis."
              )
          elif input_txt and client_files:
              st.error(
                  "Please only choose to visualize your input text or your uploaded files, not both."
              )
          elif not input_queries:
              st.error("Please provide a set of Semgrex queries.")
          else:  # no input errors
              try:
                  with st.spinner("Processing..."):
                      queries = [
                          query.strip()
                          for query in input_queries.split(",")
                      ]  # separate queries into individual parts
                      if client_files:
                          html_strings, begin_viz_idx, end_viz_idx = (
                              [],
                              0,
                              float("inf"),
                          )
                          if show_window:
                              begin_viz_idx, end_viz_idx = (
                                  start_window - 1,
                                  end_window - 1,
                              )
                          for client_file in client_files:
                              client_file_html_strings = (
                                  visualize_search_str(
                                      client_file,
                                      queries,
                                      "en",
                                      start_match=begin_viz_idx,
                                      end_match=end_viz_idx,
                                      pipe=pipe,
                                      visualize_xpos=visualize_xpos,
                                  )
                              )
                              html_strings += client_file_html_strings
                      else:  # just input text, no files
                          if show_window:
                              html_strings = visualize_search_str(
                                  input_txt,
                                  queries,
                                  "en",
                                  start_match=start_window - 1,
                                  end_match=end_window - 1,
                                  pipe=pipe,
                                  visualize_xpos=visualize_xpos,
                              )
                          else:
                              html_strings = visualize_search_str(
                                  input_txt,
                                  queries,
                                  "en",
                                  end_match=float("inf"),
                                  pipe=pipe,
                                  visualize_xpos=visualize_xpos,
                              )
  
                      if len(html_strings) == 0:
                          st.write("No Semgrex match hits!")
  
                      for s in html_strings:
                          s_no_overflow = edit_html_overflow(s)
                          components.html(
                              s_no_overflow,
                              height=300,
                              width=1000,
                              scrolling=True,
                          )
  
                      if len(html_strings) == 1:
                          st.success(
                              f"Completed! Visualized {len(html_strings)} Semgrex search hit."
                          )
                      else:
                          st.success(
                              f"Completed! Visualized {len(html_strings)} Semgrex search hits."
                          )
              except OSError:
                  st.error(
                      "Your text input or your provided Semgrex queries are incorrect. Please try again."
                  )
  
file_path: stanza/stanza/utils/visualization/semgrex_app.py
imports: import streamlit
  import streamlit.components.v1
  from semgrex_visualizer import visualize_search_str
  from semgrex_visualizer import edit_html_overflow
  from io import StringIO
  import os
  import stanza
  import typing
  from typing import List, Tuple, Any
  import argparse
label_desc: Use image node_id 6 for calling a global function with example usage: run_semgrex_process(input_txt, input_queries, client_files, show_window, clicked, pipe, start_window, end_window, visualize_xpos) without return types