Spaces:
Running
on
Zero
Running
on
Zero
modify interface
Browse files
app.py
CHANGED
@@ -37,7 +37,7 @@ def generate_response(message, history, system_message, max_tokens, temperature,
|
|
37 |
full_prompt = create_prompt(system_message, message, tool_definition, context)
|
38 |
|
39 |
if use_pipeline:
|
40 |
-
response = pipe(full_prompt, max_new_tokens=max_tokens, temperature=temperature, top_p=top_p, do_sample=
|
41 |
else:
|
42 |
max_model_length = model.config.max_position_embeddings if hasattr(model.config, 'max_position_embeddings') else 8192
|
43 |
|
@@ -69,7 +69,7 @@ def generate_response(message, history, system_message, max_tokens, temperature,
|
|
69 |
|
70 |
|
71 |
def update_advanced_settings(show_advanced):
|
72 |
-
return
|
73 |
|
74 |
with gr.Blocks() as demo:
|
75 |
with gr.Row():
|
@@ -114,7 +114,7 @@ with gr.Blocks() as demo:
|
|
114 |
|
115 |
def bot(history, system_prompt, max_length, temperature, top_p, advanced_checkbox, use_pipeline, tool_definition):
|
116 |
user_message = history[-1][0]
|
117 |
-
do_sample = advanced_checkbox
|
118 |
bot_message = generate_response(user_message, history, system_prompt, max_length, temperature, top_p, do_sample, use_pipeline, tool_definition)
|
119 |
history[-1][1] = bot_message
|
120 |
return history
|
@@ -133,7 +133,7 @@ with gr.Blocks() as demo:
|
|
133 |
advanced_checkbox.change(
|
134 |
fn=update_advanced_settings,
|
135 |
inputs=[advanced_checkbox],
|
136 |
-
outputs=
|
137 |
)
|
138 |
|
139 |
use_tool.change(
|
|
|
37 |
full_prompt = create_prompt(system_message, message, tool_definition, context)
|
38 |
|
39 |
if use_pipeline:
|
40 |
+
response = pipe(full_prompt, max_new_tokens=max_tokens, temperature=temperature, top_p=top_p, do_sample=do_sample)[0]['generated_text']
|
41 |
else:
|
42 |
max_model_length = model.config.max_position_embeddings if hasattr(model.config, 'max_position_embeddings') else 8192
|
43 |
|
|
|
69 |
|
70 |
|
71 |
def update_advanced_settings(show_advanced):
|
72 |
+
return {"visible": show_advanced}
|
73 |
|
74 |
with gr.Blocks() as demo:
|
75 |
with gr.Row():
|
|
|
114 |
|
115 |
def bot(history, system_prompt, max_length, temperature, top_p, advanced_checkbox, use_pipeline, tool_definition):
|
116 |
user_message = history[-1][0]
|
117 |
+
do_sample = advanced_checkbox
|
118 |
bot_message = generate_response(user_message, history, system_prompt, max_length, temperature, top_p, do_sample, use_pipeline, tool_definition)
|
119 |
history[-1][1] = bot_message
|
120 |
return history
|
|
|
133 |
advanced_checkbox.change(
|
134 |
fn=update_advanced_settings,
|
135 |
inputs=[advanced_checkbox],
|
136 |
+
outputs=advanced_settings
|
137 |
)
|
138 |
|
139 |
use_tool.change(
|