sanjeethnc commited on
Commit
5aac816
·
verified ·
1 Parent(s): 8e339af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +60 -8
app.py CHANGED
@@ -42,22 +42,74 @@ def respond(
42
  """
43
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
44
  """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  demo = gr.ChatInterface(
46
  respond,
47
  additional_inputs=[
48
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
49
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
50
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
51
- gr.Slider(
52
- minimum=0.1,
53
- maximum=1.0,
54
- value=0.95,
55
- step=0.05,
56
- label="Top-p (nucleus sampling)",
57
- ),
58
  ],
 
 
 
 
 
59
  )
60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
 
62
  if __name__ == "__main__":
63
  demo.launch()
 
42
  """
43
  For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
44
  """
45
+ import gradio as gr
46
+
47
+ # Respond function (you can customize it as per your use case)
48
+ def respond(message):
49
+ # Example response logic, modify this as needed
50
+ return "You said: " + message
51
+
52
+ # Custom CSS for enhancing the UI look
53
+ css = """
54
+ #chatbox {
55
+ background-color: #f7f7f7;
56
+ border-radius: 15px;
57
+ }
58
+ #submit {
59
+ background-color: #4CAF50;
60
+ color: white;
61
+ font-weight: bold;
62
+ }
63
+ #reset {
64
+ background-color: #f44336;
65
+ color: white;
66
+ font-weight: bold;
67
+ }
68
+ .gradio-container {
69
+ font-family: 'Arial', sans-serif;
70
+ background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
71
+ border-radius: 10px;
72
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
73
+ }
74
+ """
75
+
76
+ # Interface with multiple customizable settings
77
  demo = gr.ChatInterface(
78
  respond,
79
  additional_inputs=[
80
+ gr.Textbox(value="You are a friendly Chatbot.", label="System message", placeholder="Set system behavior here..."),
81
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
82
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
83
+ gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)"),
84
+ gr.Checkbox(value=True, label="Enable Markdown formatting"),
85
+ gr.File(label="Upload chat history", type="file"),
 
 
 
 
86
  ],
87
+ theme="soft",
88
+ title="My Cool Chatbot",
89
+ description="A chatbot interface with modern features.",
90
+ reset_on_submit=True,
91
+ live=True,
92
  )
93
 
94
+ # Additional Gradio components for enhancing the UI
95
+ with gr.Blocks(css=css) as interface:
96
+ gr.Markdown(
97
+ """
98
+ # Welcome to the Cool Chatbot!
99
+ Let's have a friendly chat, and feel free to tweak the settings on the left to improve our conversation!
100
+ """
101
+ )
102
+
103
+ with gr.Row():
104
+ with gr.Column(scale=3):
105
+ demo.launch()
106
+ with gr.Column(scale=1):
107
+ gr.Button("Reset Conversation", id="reset")
108
+
109
+ # Launch the app with the custom layout
110
+ interface.launch()
111
+
112
+
113
 
114
  if __name__ == "__main__":
115
  demo.launch()