code: def get_demo(
      share,
      username,
      password,
      server_port=5555,
      web_port=9889,
      loop=None,
  ):
      check_gradio_import()
      asyncio.set_event_loop(loop)
      with gr.Blocks(css=CSS) as demo:
          with gr.Row():
              with gr.Column(scale=2, width=200):
                  # store the mutliple turn conversation
                  token_to_gen = gr.Number(
                      label="Number of Tokens to generate",
                      value=300,
                      type=int,
                  )
                  min_token_to_gen = gr.Number(
                      label="Min number of Tokens to generate",
                      value=1,
                      type=int,
                  )
                  seed = gr.Number(
                      label="Random seed", value=0, type=int
                  )
                  end_strings = gr.Textbox(
                      label="End strings (comma separated)",
                      value="<extra_id_1>,",
                      lines=1,
                  )
                  add_BOS = gr.Checkbox(
                      label="Add BOS token", value=False
                  )
                  sampling_method = gr.Dropdown(
                      list(PRESETS.keys()),
                      label="Sampling Presets",
                      default="K50",
                      value="K50",
                  )
                  temperature = gr.Slider(
                      minimum=0.0,
                      maximum=5.0,
                      value=0.75,
                      label="Temperature",
                      step=0.1,
                  )
                  top_p = gr.Slider(
                      minimum=0.0,
                      maximum=1.0,
                      step=0.02,
                      value=0.95,
                      label="Top P",
                  )
                  top_k = gr.Slider(
                      minimum=0,
                      maximum=1024,
                      step=2,
                      value=50,
                      label="Top K",
                  )
  
                  repetition_penality = gr.Slider(
                      minimum=1.0,
                      maximum=5.0,
                      step=0.02,
                      value=1.0,
                      label="Repetition penalty",
                  )
  
                  def set_sampling(x):
                      return list(PRESETS[x].values())
  
                  sampling_method.change(
                      set_sampling,
                      inputs=[sampling_method],
                      outputs=[
                          temperature,
                          top_p,
                          top_k,
                          repetition_penality,
                      ],
                  )
  
              with gr.Column(scale=1, min_width=900):
                  text = gr.Textbox(
                      label="Playground",
                      value="",
                      lines=60,
                      placeholder="Type something here...",
                  )
                  submit_btn = gr.Button("Generate")
                  clear = gr.Button("Clear")
  
                  def on_submit(
                      prompt_text,
                      token_to_gen,
                      temperature,
                      top_p,
                      top_k,
                      repetition_penality,
                      seed,
                      end_strings,
                      add_BOS,
                      min_token_to_gen,
                  ):
                      output = create_gen_function(server_port)(
                          prompt_text,
                          False,
                          add_BOS,
                          token_to_gen,
                          min_token_to_gen,
                          temperature,
                          top_p,
                          top_k,
                          repetition_penality,
                          end_strings,
                      )
                      print(output)
                      print("-------------------")
                      return prompt_text + output
  
                  def clear_fun():
                      return ""
  
                  submit_btn.click(
                      on_submit,
                      [
                          text,
                          token_to_gen,
                          temperature,
                          top_p,
                          top_k,
                          repetition_penality,
                          seed,
                          end_strings,
                          add_BOS,
                          min_token_to_gen,
                      ],
                      [text],
                      queue=False,
                  )
                  clear.click(clear_fun, None, text, queue=False)
          demo.queue(concurrency_count=16).launch(
              share=share,
              server_port=web_port,
              server_name="0.0.0.0",
              auth=(username, password),
          )
  
file_path: NeMo/nemo/collections/nlp/modules/common/megatron_web_server.py
imports: import asyncio
  from nemo.collections.nlp.modules.common.chat_css import CSS
  from nemo.collections.nlp.modules.common.megatron.retrieval_services.util import convert_retrieved_to_md, request_data, text_generation
label_desc: Use image node_id 3 for calling a global function with example usage: get_demo(share, username, password, server_port, web_port, loop) and returns: list, unknown, str