Rustamshry commited on
Commit
5636348
·
verified ·
1 Parent(s): 1427fc1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -8
app.py CHANGED
@@ -53,17 +53,51 @@ def generate_response(user_input, chat_history):
53
 
54
  return gr_chat_history, chat_history
55
 
56
- # --- Launch Gradio interface ---
57
- with gr.Blocks() as demo:
58
- gr.Markdown("## 🧬 BioGenesis-ToT Chatbot")
59
- chatbot = gr.Chatbot(label="BioGenesis Chatbot", height=500)
60
- user_input = gr.Textbox(placeholder="Ask a biology question...", label="Your message")
61
- clear = gr.Button("Clear Chat")
 
 
 
 
 
62
 
63
- state = gr.State([]) # Keeps chat history
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
 
 
 
65
  user_input.submit(generate_response, [user_input, state], [chatbot, state])
66
- clear.click(lambda: ([], []), None, [chatbot, state])
 
 
 
 
 
 
67
 
68
  demo.launch(share=True)
69
 
 
53
 
54
  return gr_chat_history, chat_history
55
 
56
+ with gr.Blocks(theme=gr.themes.Soft(primary_hue="emerald", secondary_hue="slate")) as demo:
57
+ gr.HTML("""
58
+ <div style="text-align: center; margin-bottom: 20px;">
59
+ <h1 style="font-family: 'Inter', sans-serif; font-weight: 800; color: #047857; font-size: 2.2em;">
60
+ 🧬 BioGenesis-ToT Chatbot
61
+ </h1>
62
+ <p style="color: #4B5563; font-size: 1.05em; margin-top: -10px;">
63
+ Your AI companion for biology, biochemistry, and life sciences.
64
+ </p>
65
+ </div>
66
+ """)
67
 
68
+ with gr.Row():
69
+ with gr.Column(scale=6):
70
+ chatbot = gr.Chatbot(
71
+ label="BioGenesis Chat",
72
+ height=550,
73
+ bubble_full_width=False,
74
+ show_copy_button=True,
75
+ avatar_images=(
76
+ "https://cdn-icons-png.flaticon.com/512/1077/1077012.png", # user icon
77
+ "https://cdn-icons-png.flaticon.com/512/4140/4140048.png", # bot icon
78
+ ),
79
+ )
80
+ user_input = gr.Textbox(
81
+ placeholder="Ask me about cell biology, molecular structure, or biochemistry...",
82
+ label="💬 Your question",
83
+ lines=3,
84
+ autofocus=True,
85
+ )
86
+ with gr.Row():
87
+ send_btn = gr.Button("🚀 Send", variant="primary")
88
+ clear_btn = gr.Button("🧹 Clear Chat")
89
 
90
+ state = gr.State([])
91
+
92
+ send_btn.click(generate_response, [user_input, state], [chatbot, state])
93
  user_input.submit(generate_response, [user_input, state], [chatbot, state])
94
+ clear_btn.click(lambda: ([], []), None, [chatbot, state])
95
+
96
+ gr.HTML("""
97
+ <div style="text-align: center; margin-top: 25px; color: #6B7280; font-size: 0.9em;">
98
+ Powered by <b>Qwen3-1.7B + BioGenesis-ToT</b> | Built with ❤️ using Gradio
99
+ </div>
100
+ """)
101
 
102
  demo.launch(share=True)
103