Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -17,6 +17,30 @@ InferenceClient(models[2]),
|
|
17 |
InferenceClient(models[3]),
|
18 |
]
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
VERBOSE=False
|
21 |
|
22 |
def format_prompt(message, history, cust_p):
|
@@ -29,7 +53,7 @@ def format_prompt(message, history, cust_p):
|
|
29 |
prompt += f"{bot_response}\n"
|
30 |
#print(prompt)
|
31 |
#prompt += f"<start_of_turn>user\n{message}<end_of_turn>\n<start_of_turn>model\n"
|
32 |
-
prompt+=cust_p.
|
33 |
return prompt
|
34 |
|
35 |
def custom_prompt(prompt):
|
@@ -137,6 +161,9 @@ with gr.Blocks() as app:
|
|
137 |
theme=gr.Radio(label="Theme", choices=["light","dark"],value="light")
|
138 |
chatblock=gr.Dropdown(label="Chatblocks",info="Choose specific blocks of chat",choices=[c for c in range(1,40)],multiselect=True)
|
139 |
|
|
|
|
|
|
|
140 |
im_go=im_btn.click(get_screenshot,[chat_b,im_height,im_width,chatblock,theme,wait_time],img)
|
141 |
|
142 |
chat_sub=inp.submit(check_rand,[rand,seed],seed).then(chat_inf,[sys_inp,inp,chat_b,memory,client_choice,seed,temp,tokens,top_p,rep_p,chat_mem,custom_prompt],[chat_b,memory])
|
|
|
17 |
InferenceClient(models[3]),
|
18 |
]
|
19 |
|
20 |
+
|
21 |
+
models=[
|
22 |
+
"google/gemma-7b",
|
23 |
+
"google/gemma-7b-it",
|
24 |
+
"google/gemma-2b",
|
25 |
+
"google/gemma-2b-it",
|
26 |
+
]
|
27 |
+
client_z=[]
|
28 |
+
|
29 |
+
|
30 |
+
def load_models(inp):
|
31 |
+
|
32 |
+
out_box=[gr.Chatbot(),gr.Chatbot(),gr.Chatbot(),gr.Chatbot()]
|
33 |
+
print(type(inp))
|
34 |
+
print(inp)
|
35 |
+
print(models[inp[0]])
|
36 |
+
client_z.clear()
|
37 |
+
client_z.append(InferenceClient(models[inp[z]]))
|
38 |
+
return gr.update(label=models[inp[z]])
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
|
43 |
+
|
44 |
VERBOSE=False
|
45 |
|
46 |
def format_prompt(message, history, cust_p):
|
|
|
53 |
prompt += f"{bot_response}\n"
|
54 |
#print(prompt)
|
55 |
#prompt += f"<start_of_turn>user\n{message}<end_of_turn>\n<start_of_turn>model\n"
|
56 |
+
prompt+=cust_p.replace("USER_INPUT",message)
|
57 |
return prompt
|
58 |
|
59 |
def custom_prompt(prompt):
|
|
|
161 |
theme=gr.Radio(label="Theme", choices=["light","dark"],value="light")
|
162 |
chatblock=gr.Dropdown(label="Chatblocks",info="Choose specific blocks of chat",choices=[c for c in range(1,40)],multiselect=True)
|
163 |
|
164 |
+
|
165 |
+
client_choice.change(load_models,client_choice,[chat_b])
|
166 |
+
|
167 |
im_go=im_btn.click(get_screenshot,[chat_b,im_height,im_width,chatblock,theme,wait_time],img)
|
168 |
|
169 |
chat_sub=inp.submit(check_rand,[rand,seed],seed).then(chat_inf,[sys_inp,inp,chat_b,memory,client_choice,seed,temp,tokens,top_p,rep_p,chat_mem,custom_prompt],[chat_b,memory])
|