AnkitkumarMalde commited on
Commit
7d8680a
·
verified ·
1 Parent(s): 6cf9896

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -1
app.py CHANGED
@@ -35,7 +35,50 @@ def respond(message, history):
35
  yield response
36
 
37
  # 2. Simplified UI
38
- demo = gr.ChatInterface(respond)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
  if __name__ == "__main__":
41
  demo.launch()
 
35
  yield response
36
 
37
  # 2. Simplified UI
38
+ # Change your demo line to this:
39
+ demo = gr.ChatInterface(
40
+ fn=chat_function,
41
+ theme="ocean", # Try "glass", "soft", or "monochrome"
42
+ title="🚀 AI Assistant Pro",
43
+ description="Developed by Kewal Dand | High-performance Chatbot",
44
+ examples=["Calculate my tax", "Explain RPA", "Cricket news"],
45
+ textbox=gr.Textbox(placeholder="Ask me anything...", container=False, scale=7),
46
+ )
47
+
48
+ # Custom CSS for a sleek, modern look
49
+ css = """
50
+ .gradio-container { background-color: #f0f2f5; }
51
+ #title { text-align: center; color: #2d3436; font-family: 'Arial'; }
52
+ #chat-box { border-radius: 15px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
53
+ """
54
+
55
+ with gr.Blocks(css=css, theme=gr.themes.Soft()) as demo:
56
+ gr.Markdown("# 🤖 Advanced Chat Interface", elem_id="title")
57
+
58
+ with gr.Row():
59
+ with gr.Column(scale=4):
60
+ chatbot = gr.Chatbot(elem_id="chat-box", height=500)
61
+ msg = gr.Textbox(show_label=False, placeholder="Enter text and press enter...")
62
+
63
+ with gr.Column(scale=1):
64
+ gr.Markdown("### Settings")
65
+ temp = gr.Slider(0, 1, value=0.7, label="Creativity (Temperature)")
66
+ clear = gr.Button("Clear Conversation")
67
+
68
+ # Link functionality
69
+ def user(user_message, history):
70
+ return "", history + [[user_message, None]]
71
+
72
+ def bot(history):
73
+ # Your chatbot logic here
74
+ bot_message = "This is a styled response!"
75
+ history[-1][1] = bot_message
76
+ return history
77
+
78
+ msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
79
+ bot, chatbot, chatbot
80
+ )
81
+ clear.click(lambda: None, None, chatbot, queue=False)
82
 
83
  if __name__ == "__main__":
84
  demo.launch()