nruto commited on
Commit
ef2447e
·
verified ·
1 Parent(s): cb63621

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -19
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
- demo = gr.ChatInterface(
46
- respond,
47
- title="Welcome to Rxple Chat Bot",
48
- description="Follow us on [Instagram](https://www.instagram.com/khellon_patel_21)",
49
- additional_inputs=[
50
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
51
- gr.Slider(minimum=1, maximum=2048, value=2048, step=1, label="Max new tokens"),
52
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
53
- gr.Slider(
54
- minimum=0.1,
55
- maximum=1.0,
56
- value=0.95,
57
- step=0.05,
58
- label="Top-p (nucleus sampling)",
59
- ),
60
- ],
61
- css=opq # Add the custom CSS here
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
+ &copy; 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)