BICORP commited on
Commit
3a72ffa
·
verified ·
1 Parent(s): 7b1926c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -2,22 +2,22 @@ import random
2
  from gradio_client import Client
3
  import gradio as gr
4
 
5
- # List of available servers
6
  servers = [
7
  "BICORP/GOGOGOGO",
8
  "BICORP/server-2",
9
  "BICORP/server-3",
10
  "BICORP/server-4",
11
- "BICORP/server-5",
12
- "BICORP/server-6"
13
  ]
14
 
15
  # Function to call the API with error handling
16
  def call_api(message, model, preset):
17
- selected_server = random.choice(servers)
18
- client = Client(selected_server)
19
 
20
  try:
 
21
  result = client.predict(
22
  message=message,
23
  param_2=model,
@@ -32,7 +32,7 @@ def call_api(message, model, preset):
32
  css = """
33
  .gradio-container {
34
  background-color: #f0f0f0;
35
- font-family: Arial, sans-serif;
36
  padding: 20px;
37
  border-radius: 10px;
38
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
@@ -89,8 +89,8 @@ def create_interface():
89
 
90
  # Settings moved to the bottom
91
  with gr.Accordion("Settings", open=False, elem_id="settings-container"):
92
- model = gr.Dropdown(choices=["Lake 1 Base"], label="Select Model", value="Lake 1 Base")
93
- preset = gr.Dropdown(choices=["Fast", "Normal", "Quality", "Unreal Performance"], label="Select Preset", value="Fast")
94
 
95
  # Button click event with loading indicator
96
  submit_btn.click(call_api, inputs=[message, model, preset], outputs=output)
 
2
  from gradio_client import Client
3
  import gradio as gr
4
 
5
+ # List of available servers (replace with actual server endpoints)
6
  servers = [
7
  "BICORP/GOGOGOGO",
8
  "BICORP/server-2",
9
  "BICORP/server-3",
10
  "BICORP/server-4",
11
+ "BICORP/server-5"
 
12
  ]
13
 
14
  # Function to call the API with error handling
15
  def call_api(message, model, preset):
16
+ selected_server = random.choice(servers) # Randomly select a server
17
+ client = Client(selected_server) # Create a client for the selected server
18
 
19
  try:
20
+ # Call the /chat endpoint with the provided parameters
21
  result = client.predict(
22
  message=message,
23
  param_2=model,
 
32
  css = """
33
  .gradio-container {
34
  background-color: #f0f0f0;
35
+ font-family: 'Arial', sans-serif;
36
  padding: 20px;
37
  border-radius: 10px;
38
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
 
89
 
90
  # Settings moved to the bottom
91
  with gr.Accordion("Settings", open=False, elem_id="settings-container"):
92
+ model = gr.Dropdown(choices=["Model A", "Model B"], label="Select Model", value="Model A")
93
+ preset = gr.Dropdown(choices=["Fast", "Normal", "Quality"], label="Select Preset", value="Fast")
94
 
95
  # Button click event with loading indicator
96
  submit_btn.click(call_api, inputs=[message, model, preset], outputs=output)