Omnibus commited on
Commit
ae1f197
1 Parent(s): e4e0162

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -2
app.py CHANGED
@@ -23,6 +23,23 @@ InferenceClient(models[2]),
23
  InferenceClient(models[3]),
24
  ]'''
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  def format_prompt(message, history):
27
  prompt = ""
28
  if history:
@@ -104,7 +121,7 @@ with gr.Blocks() as app:
104
  with gr.Group():
105
  stop_btn=gr.Button("Stop")
106
  clear_btn=gr.Button("Clear")
107
- client_choice=gr.Dropdown(label="Models",type='index',choices=[c for c in models],value=models[0],interactive=True)
108
 
109
  with gr.Column(scale=1):
110
  with gr.Group():
@@ -127,7 +144,7 @@ with gr.Blocks() as app:
127
  theme=gr.Radio(label="Theme", choices=["light","dark"],value="light")
128
  chatblock=gr.Dropdown(label="Chatblocks",info="Choose specific blocks of chat",choices=[c for c in range(1,40)],multiselect=True)
129
 
130
-
131
 
132
  #im_go=im_btn.click(get_screenshot,[chat_b,im_height,im_width,chatblock,theme,wait_time],img)
133
  #chat_sub=inp.submit(check_rand,[rand,seed],seed).then(chat_inf,[sys_inp,inp,chat_b,client_choice,seed,temp,tokens,top_p,rep_p],chat_b)
 
23
  InferenceClient(models[3]),
24
  ]'''
25
 
26
+ client_z=[]
27
+
28
+
29
+ def load_models(inp):
30
+ print(type(inp))
31
+ client_z.clear()
32
+ if inp[0]:
33
+ client_z[0]=InferenceClient(models[inp[0]])
34
+ if inp[1]:
35
+ client_z[1]=InferenceClient(models[inp[1]])
36
+ if inp[2]:
37
+ client_z[2]=InferenceClient(models[inp[2]])
38
+ if inp[3]:
39
+ client_z[3]=InferenceClient(models[inp[3]])
40
+ return gr.update(label=models[inp[0]])
41
+
42
+
43
  def format_prompt(message, history):
44
  prompt = ""
45
  if history:
 
121
  with gr.Group():
122
  stop_btn=gr.Button("Stop")
123
  clear_btn=gr.Button("Clear")
124
+ client_choice=gr.Dropdown(label="Models",type='index',choices=[c for c in models],value=models[0],multiselect=True,interactive=True)
125
 
126
  with gr.Column(scale=1):
127
  with gr.Group():
 
144
  theme=gr.Radio(label="Theme", choices=["light","dark"],value="light")
145
  chatblock=gr.Dropdown(label="Chatblocks",info="Choose specific blocks of chat",choices=[c for c in range(1,40)],multiselect=True)
146
 
147
+ client_choice.change(load_models,client_choice,chat_a)
148
 
149
  #im_go=im_btn.click(get_screenshot,[chat_b,im_height,im_width,chatblock,theme,wait_time],img)
150
  #chat_sub=inp.submit(check_rand,[rand,seed],seed).then(chat_inf,[sys_inp,inp,chat_b,client_choice,seed,temp,tokens,top_p,rep_p],chat_b)