pragyarama commited on
Commit
5b71334
·
verified ·
1 Parent(s): acb1e12

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -2
app.py CHANGED
@@ -98,6 +98,23 @@ def respond(message, history): # Generate a response using the most relevant tra
98
 
99
  return response["choices"][0]["message"]["content"].strip()
100
 
101
- chatbot = gr.ChatInterface(respond, type="messages")
 
 
 
102
 
103
- chatbot.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
  return response["choices"][0]["message"]["content"].strip()
100
 
101
+ # SURVEY
102
+ def submit_survey(name, gender):
103
+ print(f"Survey received - Name: {name}, Gender: {gender}")
104
+ return f"Thank you, {name}! Your survey response has been recorded."
105
 
106
+ with gr.Blocks() as demo:
107
+ gr.Markdown("## Survey")
108
+
109
+ with gr.Row():
110
+ name = gr.Textbox(label="Name", placeholder="Enter your name")
111
+ gender = gr.Textbox(label="Gender", placeholder="Enter your gender")
112
+ submit_btn = gr.Button("Submit")
113
+ survey_output = gr.Textbox(label="Survey Response")
114
+
115
+ submit_btn.click(submit_survey, inputs=[name, gender], outputs=survey_output)
116
+
117
+ gr.Markdown("## Chatbot")
118
+ chatbot = gr.ChatInterface(respond, chatbot=True)
119
+
120
+ demo.launch()