RithikaChalam commited on
Commit
4f4e78d
·
verified ·
1 Parent(s): 7dca0b2

trying example button code

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -19,6 +19,18 @@ with open("strict_mom_phrases.txt", "r", encoding="utf-8") as file:
19
  # Read the entire contents of the file and store it in a variable
20
  strict_mom_text = file.read()
21
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  # STEP 3 FROM SEMANTIC SEARCH
23
  def preprocess_text(text):
24
  # Strip extra whitespace from the beginning and the end of the text
 
19
  # Read the entire contents of the file and store it in a variable
20
  strict_mom_text = file.read()
21
 
22
+ def greet(name):
23
+ return f"Hello, {name}!"
24
+
25
+ with gr.Blocks() as demo:
26
+ name_input = gr.Textbox(label="Enter your name")
27
+ greet_button = gr.Button(value="Say Hello!", variant="primary")
28
+ output_text = gr.Textbox(label="Greeting")
29
+
30
+ greet_button.click(fn=greet, inputs=name_input, outputs=output_text)
31
+
32
+ demo.launch()
33
+
34
  # STEP 3 FROM SEMANTIC SEARCH
35
  def preprocess_text(text):
36
  # Strip extra whitespace from the beginning and the end of the text