Update app.py
Browse files
app.py
CHANGED
|
@@ -28,21 +28,24 @@ def hive_response(query, bots_config_json):
|
|
| 28 |
# Collect responses from all bots
|
| 29 |
responses = [future.result() for future in futures]
|
| 30 |
|
| 31 |
-
return [f"
|
| 32 |
|
| 33 |
# Define the Gradio interface
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
iface = gr.Interface(
|
| 35 |
fn=hive_response,
|
| 36 |
inputs=[
|
| 37 |
gr.Textbox(label="Query"),
|
| 38 |
-
gr.Textbox(label="Bots Configuration (JSON)", default=
|
| 39 |
-
{"api_key": "tune-adafd1fc-f66f-4242-aed1-c0ce3722718a1711930019", "base_url": "https://chat.tune.app/api/", "model_name": "goliath-120b-16k-gptq"},
|
| 40 |
-
{"api_key": "tune-bbb2d24b-f913-48d3-b3fe-dcf2b8ed10371711926291", "base_url": "https://chat.tune.app/api/", "model_name": "goliath-120b-16k-gptq"},
|
| 41 |
-
{"api_key": "tune-a67090f0-e25e-4769-a67e-86d71ba22e0f1696395693", "base_url": "https://chat.tune.app/api/", "model_name": "goliath-120b-16k-gptq"}
|
| 42 |
-
], indent=2))
|
| 43 |
],
|
| 44 |
outputs=[gr.Text(label="Responses")],
|
| 45 |
-
description="Enter your query and bots
|
| 46 |
)
|
| 47 |
|
| 48 |
iface.launch()
|
|
|
|
| 28 |
# Collect responses from all bots
|
| 29 |
responses = [future.result() for future in futures]
|
| 30 |
|
| 31 |
+
return [f"{bot['role']} Bot response: {response}" for bot, response in zip(bots_config, responses)]
|
| 32 |
|
| 33 |
# Define the Gradio interface
|
| 34 |
+
default_bots_config = json.dumps([
|
| 35 |
+
{"role": "HR", "tune-adafd1fc-f66f-4242-aed1-c0ce3722718a1711930019": "tune-hr-api-key", "base_url": "https://chat.tune.app/api/chat/completions", "model_name": "goliath-120b-16k-gptq"},
|
| 36 |
+
{"role": "IT", "tune-adafd1fc-f66f-4242-aed1-c0ce3722718a1711930019": "tune-it-api-key", "base_url": "https://chat.tune.app/api/chat/completions", "model_name": "goliath-120b-16k-gptq"},
|
| 37 |
+
{"role": "Sales", "tune-adafd1fc-f66f-4242-aed1-c0ce3722718a1711930019": "tune-sales-api-key", "base_url": "https://chat.tune.app/api/chat/completions", "model_name": "goliath-120b-16k-gptq"},
|
| 38 |
+
{"role": "Customer Support", "tune-adafd1fc-f66f-4242-aed1-c0ce3722718a1711930019": "tune-cs-api-key", "base_url": "https://chat.tune.app/api/chat/completions", "model_name": "goliath-120b-16k-gptq"}
|
| 39 |
+
], indent=2)
|
| 40 |
+
|
| 41 |
iface = gr.Interface(
|
| 42 |
fn=hive_response,
|
| 43 |
inputs=[
|
| 44 |
gr.Textbox(label="Query"),
|
| 45 |
+
gr.Textbox(label="Bots Configuration (JSON)", default=default_bots_config)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
],
|
| 47 |
outputs=[gr.Text(label="Responses")],
|
| 48 |
+
description="Enter your query and configure the bots in JSON format to simulate interactions with different company departments."
|
| 49 |
)
|
| 50 |
|
| 51 |
iface.launch()
|