AEUPH commited on
Commit
435e077
·
verified ·
1 Parent(s): c53a77e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
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"Bot {idx} response: {response}" for idx, response in enumerate(responses, 1)]
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=json.dumps([
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 configuration in JSON format to get responses from a hive of chatbots."
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()