Spaces:
Paused
Paused
Update app.py
Browse files
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 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
interactive=False
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
label="
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 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__":
|