Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -74,7 +74,7 @@ css = """
|
|
74 |
border: 1px solid #ccc;
|
75 |
border-radius: 20px;
|
76 |
overflow: hidden;
|
77 |
-
background: url('https://
|
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.
|
93 |
-
gr.
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
examples=
|
118 |
-
[
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
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)
|