Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -35,31 +35,56 @@ def respond(
|
|
35 |
response += token
|
36 |
yield response
|
37 |
|
38 |
-
# Custom CSS to change the title color
|
39 |
opq = """
|
40 |
.gradio-container h1 {
|
41 |
color: #40E0D0 !important;
|
42 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
"""
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
)
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
if __name__ == "__main__":
|
65 |
demo.launch(share=True)
|
|
|
35 |
response += token
|
36 |
yield response
|
37 |
|
38 |
+
# Custom CSS to change the title color and add a copyright notice
|
39 |
opq = """
|
40 |
.gradio-container h1 {
|
41 |
color: #40E0D0 !important;
|
42 |
}
|
43 |
+
|
44 |
+
/* Add a footer for the copyright notice */
|
45 |
+
#custom-footer {
|
46 |
+
position: fixed;
|
47 |
+
bottom: 0;
|
48 |
+
width: 100%;
|
49 |
+
background-color: #f1f1f1;
|
50 |
+
text-align: center;
|
51 |
+
padding: 10px 0;
|
52 |
+
font-size: 14px;
|
53 |
+
color: #333;
|
54 |
+
z-index: 1000; /* Ensure the footer is above other elements */
|
55 |
+
}
|
56 |
+
"""
|
57 |
+
|
58 |
+
# HTML for the copyright notice
|
59 |
+
footer_html = """
|
60 |
+
<div id="custom-footer">
|
61 |
+
© 2023 Your Company Name. All rights reserved.
|
62 |
+
</div>
|
63 |
"""
|
64 |
|
65 |
+
with gr.Blocks(css=opq) as demo:
|
66 |
+
gr.Markdown("# Welcome to Rxple Chat Bot")
|
67 |
+
gr.Markdown("Follow us on [Instagram](https://www.instagram.com/khellon_patel_21)")
|
68 |
+
|
69 |
+
chatbot = gr.Chatbot()
|
70 |
+
message = gr.Textbox(placeholder="Type a message...")
|
71 |
+
submit = gr.Button("Send")
|
72 |
+
|
73 |
+
with gr.Row():
|
74 |
+
system_message = gr.Textbox(value="You are a friendly Chatbot.", label="System message")
|
75 |
+
max_tokens = gr.Slider(minimum=1, maximum=2048, value=2048, step=1, label="Max new tokens")
|
76 |
+
temperature = gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature")
|
77 |
+
top_p = gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)")
|
78 |
+
|
79 |
+
gr.HTML(footer_html) # Add the footer HTML here
|
80 |
+
|
81 |
+
def update_chat(message, history, system_message, max_tokens, temperature, top_p):
|
82 |
+
response = list(respond(message, history, system_message, max_tokens, temperature, top_p))
|
83 |
+
history.append((message, response[-1]))
|
84 |
+
return history, history
|
85 |
+
|
86 |
+
submit.click(update_chat, [message, chatbot, system_message, max_tokens, temperature, top_p], [chatbot, chatbot])
|
87 |
+
message.submit(update_chat, [message, chatbot, system_message, max_tokens, temperature, top_p], [chatbot, chatbot])
|
88 |
|
89 |
if __name__ == "__main__":
|
90 |
demo.launch(share=True)
|