peterkros commited on
Commit
1577770
·
verified ·
1 Parent(s): fb397d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -37
app.py CHANGED
@@ -74,7 +74,7 @@ css = """
74
  border: 1px solid #ccc;
75
  border-radius: 20px;
76
  overflow: hidden;
77
- background: url('https://huggingface.co/spaces/peterkros/child-safe-chatbot/blob/main/iPhone-mob.png') no-repeat center center;
78
  background-size: cover;
79
  height: 700px;
80
  padding: 20px;
@@ -89,42 +89,43 @@ css = """
89
  """
90
 
91
  with gr.Blocks(css=css) as demo:
92
- with gr.Column(elem_id="chat-container"):
93
- gr.Markdown(
94
- """
95
- # Child safe chatbot project!
96
- In the realm of digital communication, the development of an advanced chatbot that incorporates topic modeling represents a significant leap towards enhancing user interaction and maintaining focus during conversations. This innovative chatbot design is specifically engineered to streamline discussions by guiding users to select from a curated list of suggested questions. This approach is crafted to mitigate the risk of diverging into off-topic dialogues, which are common pitfalls in conventional chatbot systems.
97
- """
98
- )
99
-
100
- chatbot = gr.Chatbot(
101
- initialize_chat(),
102
- elem_id="chatbot",
103
- bubble_full_width=False,
104
- label="Safe Chatbot v1",
105
- avatar_images=(None, os.path.join(os.getcwd(), "avatar.png"))
106
- )
107
-
108
- with gr.Row():
109
- txt = gr.Textbox(scale=4, show_label=False, placeholder="Select Question", container=False, interactive=False) # Adjust based on need
110
- btn = gr.Button("Submit")
111
-
112
- examples_df = gr.Dataframe(headers=["Suggested Questions"], datatype="str", interactive=False)
113
-
114
- btn.click(fn=generate_response, inputs=[txt], outputs=[chatbot, examples_df])
115
-
116
- examples = gr.Examples(
117
- examples=[
118
- ["What are the basic requirements to become an airforce pilot?"],
119
- ["How long does it take to train as an airforce pilot?"],
120
- ["Can you describe a day in the life of an airforce pilot?"]
121
- ],
122
- inputs=[txt],
123
- outputs=[chatbot],
124
- label="Select Question"
125
- )
126
-
127
- chatbot.like(print_like_dislike, None, None)
 
128
 
129
  if __name__ == "__main__":
130
  demo.launch(share=True)
 
74
  border: 1px solid #ccc;
75
  border-radius: 20px;
76
  overflow: hidden;
77
+ background: url('https://path-to-your-phone-background-image.png') no-repeat center center;
78
  background-size: cover;
79
  height: 700px;
80
  padding: 20px;
 
89
  """
90
 
91
  with gr.Blocks(css=css) as demo:
92
+ with gr.Row():
93
+ with gr.Column(scale=1):
94
+ gr.Markdown(
95
+ """
96
+ # Child safe chatbot project!
97
+ In the realm of digital communication, the development of an advanced chatbot that incorporates topic modeling represents a significant leap towards enhancing user interaction and maintaining focus during conversations. This innovative chatbot design is specifically engineered to streamline discussions by guiding users to select from a curated list of suggested questions. This approach is crafted to mitigate the risk of diverging into off-topic dialogues, which are common pitfalls in conventional chatbot systems.
98
+ """
99
+ )
100
+ with gr.Column(scale=1, elem_id="chat-container"):
101
+ chatbot = gr.Chatbot(
102
+ initialize_chat(),
103
+ elem_id="chatbot",
104
+ bubble_full_width=False,
105
+ label="Safe Chatbot v1",
106
+ avatar_images=(None, os.path.join(os.getcwd(), "avatar.png"))
107
+ )
108
+
109
+ with gr.Row():
110
+ txt = gr.Textbox(scale=4, show_label=False, placeholder="Select Question", container=False, interactive=False) # Adjust based on need
111
+ btn = gr.Button("Submit")
112
+
113
+ examples_df = gr.Dataframe(headers=["Suggested Questions"], datatype="str", interactive=False)
114
+
115
+ btn.click(fn=generate_response, inputs=[txt], outputs=[chatbot, examples_df])
116
+
117
+ examples = gr.Examples(
118
+ examples=[
119
+ ["What are the basic requirements to become an airforce pilot?"],
120
+ ["How long does it take to train as an airforce pilot?"],
121
+ ["Can you describe a day in the life of an airforce pilot?"]
122
+ ],
123
+ inputs=[txt],
124
+ outputs=[chatbot],
125
+ label="Select Question"
126
+ )
127
+
128
+ chatbot.like(print_like_dislike, None, None)
129
 
130
  if __name__ == "__main__":
131
  demo.launch(share=True)