deepak191z commited on
Commit
cc8dc14
·
verified ·
1 Parent(s): 6bb0aac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +114 -117
app.py CHANGED
@@ -128,123 +128,120 @@ with gr.Blocks(css=custom_css, title="Agent Rox", theme=gr.themes.Soft()) as dem
128
  with gr.Tabs():
129
  # Chat Tab
130
  with gr.Tab("chat"):
131
- with gr.Tabs():
132
- # Chat Tab
133
- with gr.Tab("chat"):
134
- with gr.Column():
135
- chatbot = gr.Chatbot(
136
- value=[],
137
- elem_classes=["chat-container"],
138
- height=400,
139
- show_label=False
140
- )
141
- with gr.Row(elem_classes=["input-container"]):
142
- with gr.Column(scale=4):
143
- msg_input = gr.Textbox(
144
- placeholder="types your message",
145
- show_label=False,
146
- container=False
147
- )
148
- with gr.Column(scale=1):
149
- send_btn = gr.Button("Send", elem_classes=["send-button"])
150
-
151
- # Chat functionality
152
- def respond(message, chat_history):
153
- bot_message = f"Agent Rox: I received your message '{message}'. How can I help you today?"
154
- chat_history.append([message, bot_message])
155
- return chat_history, ""
156
-
157
- send_btn.click(respond, [msg_input, chatbot], [chatbot, msg_input])
158
- msg_input.submit(respond, [msg_input, chatbot], [chatbot, msg_input])
159
-
160
- # Task Tab
161
- with gr.Tab("task"):
162
- with gr.Column():
163
- gr.Markdown("## Task Management")
164
- task_input = gr.Textbox(
165
- label="Enter Task",
166
- placeholder="Describe the task you want Agent Rox to perform...",
167
- lines=4
168
- )
169
- task_btn = gr.Button("Process Task")
170
- task_output = gr.Textbox(label="Task Result", interactive=False)
171
-
172
- task_btn.click(task_function, inputs=task_input, outputs=task_output)
173
-
174
- # AI Agents Tab
175
- with gr.Tab("ai agents"):
176
- with gr.Column():
177
- gr.Markdown("## AI Agents Configuration")
178
- agent_name = gr.Textbox(label="Agent Name", placeholder="Enter agent name...")
179
- agent_type = gr.Dropdown(
180
- choices=["GPT-4", "Claude", "Gemini", "Custom"],
181
- label="Agent Type"
182
- )
183
- agent_config = gr.Textbox(
184
- label="Configuration",
185
- placeholder="Enter agent configuration...",
186
- lines=3
187
- )
188
- config_btn = gr.Button("Configure Agent")
189
- agent_output = gr.Textbox(label="Configuration Result", interactive=False)
190
-
191
- config_btn.click(
192
- lambda name, type_val, config: f"Agent '{name}' of type '{type_val}' configured with: {config}",
193
- inputs=[agent_name, agent_type, agent_config],
194
- outputs=agent_output
195
- )
196
-
197
- # Cookies Tab
198
- with gr.Tab("cookies"):
199
- with gr.Column():
200
- gr.Markdown("## Cookies Management")
201
- gr.Markdown("Manage your session cookies and preferences here.")
202
- cookies_info = gr.Textbox(
203
- label="Current Cookies",
204
- value="Session cookies are active",
205
- interactive=False
206
- )
207
- clear_cookies_btn = gr.Button("Clear Cookies")
208
- cookies_status = gr.Textbox(label="Status", interactive=False)
209
-
210
- clear_cookies_btn.click(
211
- lambda: "Cookies cleared successfully",
212
- outputs=cookies_status
213
- )
214
-
215
- # Config Tab
216
- with gr.Tab("config"):
217
- with gr.Column():
218
- gr.Markdown("## System Configuration")
219
- api_key = gr.Textbox(
220
- label="API Key",
221
- placeholder="Enter your API key...",
222
- type="password"
223
- )
224
- model_selection = gr.Dropdown(
225
- choices=["GPT-4", "GPT-3.5", "Claude-3", "Gemini-Pro"],
226
- label="Default Model",
227
- value="GPT-4"
228
- )
229
- temperature = gr.Slider(
230
- minimum=0.0,
231
- maximum=2.0,
232
- value=0.7,
233
- step=0.1,
234
- label="Temperature"
235
- )
236
- save_config_btn = gr.Button("Save Configuration")
237
- config_status = gr.Textbox(label="Configuration Status", interactive=False)
238
-
239
- save_config_btn.click(
240
- lambda key, model, temp: f"Configuration saved - Model: {model}, Temperature: {temp}",
241
- inputs=[api_key, model_selection, temperature],
242
- outputs=config_status
243
- )
244
-
245
- # How to Use Tab
246
- with gr.Tab("how to use"):
247
- gr.Markdown(how_to_use_function())
248
 
249
  # Launch the interface
250
  if __name__ == "__main__":
 
128
  with gr.Tabs():
129
  # Chat Tab
130
  with gr.Tab("chat"):
131
+ with gr.Column():
132
+ chatbot = gr.Chatbot(
133
+ value=[],
134
+ elem_classes=["chat-container"],
135
+ height=400,
136
+ show_label=False
137
+ )
138
+ with gr.Row(elem_classes=["input-container"]):
139
+ with gr.Column(scale=4):
140
+ msg_input = gr.Textbox(
141
+ placeholder="types your message",
142
+ show_label=False,
143
+ container=False
144
+ )
145
+ with gr.Column(scale=1):
146
+ send_btn = gr.Button("Send", elem_classes=["send-button"])
147
+
148
+ # Chat functionality
149
+ def respond(message, chat_history):
150
+ bot_message = f"Agent Rox: I received your message '{message}'. How can I help you today?"
151
+ chat_history.append([message, bot_message])
152
+ return chat_history, ""
153
+
154
+ send_btn.click(respond, [msg_input, chatbot], [chatbot, msg_input])
155
+ msg_input.submit(respond, [msg_input, chatbot], [chatbot, msg_input])
156
+
157
+ # Task Tab
158
+ with gr.Tab("task"):
159
+ with gr.Column():
160
+ gr.Markdown("## Task Management")
161
+ task_input = gr.Textbox(
162
+ label="Enter Task",
163
+ placeholder="Describe the task you want Agent Rox to perform...",
164
+ lines=4
165
+ )
166
+ task_btn = gr.Button("Process Task")
167
+ task_output = gr.Textbox(label="Task Result", interactive=False)
168
+
169
+ task_btn.click(task_function, inputs=task_input, outputs=task_output)
170
+
171
+ # AI Agents Tab
172
+ with gr.Tab("ai agents"):
173
+ with gr.Column():
174
+ gr.Markdown("## AI Agents Configuration")
175
+ agent_name = gr.Textbox(label="Agent Name", placeholder="Enter agent name...")
176
+ agent_type = gr.Dropdown(
177
+ choices=["GPT-4", "Claude", "Gemini", "Custom"],
178
+ label="Agent Type"
179
+ )
180
+ agent_config = gr.Textbox(
181
+ label="Configuration",
182
+ placeholder="Enter agent configuration...",
183
+ lines=3
184
+ )
185
+ config_btn = gr.Button("Configure Agent")
186
+ agent_output = gr.Textbox(label="Configuration Result", interactive=False)
187
+
188
+ config_btn.click(
189
+ lambda name, type_val, config: f"Agent '{name}' of type '{type_val}' configured with: {config}",
190
+ inputs=[agent_name, agent_type, agent_config],
191
+ outputs=agent_output
192
+ )
193
+
194
+ # Cookies Tab
195
+ with gr.Tab("cookies"):
196
+ with gr.Column():
197
+ gr.Markdown("## Cookies Management")
198
+ gr.Markdown("Manage your session cookies and preferences here.")
199
+ cookies_info = gr.Textbox(
200
+ label="Current Cookies",
201
+ value="Session cookies are active",
202
+ interactive=False
203
+ )
204
+ clear_cookies_btn = gr.Button("Clear Cookies")
205
+ cookies_status = gr.Textbox(label="Status", interactive=False)
206
+
207
+ clear_cookies_btn.click(
208
+ lambda: "Cookies cleared successfully",
209
+ outputs=cookies_status
210
+ )
211
+
212
+ # Config Tab
213
+ with gr.Tab("config"):
214
+ with gr.Column():
215
+ gr.Markdown("## System Configuration")
216
+ api_key = gr.Textbox(
217
+ label="API Key",
218
+ placeholder="Enter your API key...",
219
+ type="password"
220
+ )
221
+ model_selection = gr.Dropdown(
222
+ choices=["GPT-4", "GPT-3.5", "Claude-3", "Gemini-Pro"],
223
+ label="Default Model",
224
+ value="GPT-4"
225
+ )
226
+ temperature = gr.Slider(
227
+ minimum=0.0,
228
+ maximum=2.0,
229
+ value=0.7,
230
+ step=0.1,
231
+ label="Temperature"
232
+ )
233
+ save_config_btn = gr.Button("Save Configuration")
234
+ config_status = gr.Textbox(label="Configuration Status", interactive=False)
235
+
236
+ save_config_btn.click(
237
+ lambda key, model, temp: f"Configuration saved - Model: {model}, Temperature: {temp}",
238
+ inputs=[api_key, model_selection, temperature],
239
+ outputs=config_status
240
+ )
241
+
242
+ # How to Use Tab
243
+ with gr.Tab("how to use"):
244
+ gr.Markdown(how_to_use_function())
 
 
 
245
 
246
  # Launch the interface
247
  if __name__ == "__main__":