Staticaliza
commited on
Commit
•
c3fca4f
1
Parent(s):
fffd67e
Update app.py
Browse files
app.py
CHANGED
@@ -10,6 +10,8 @@ KEY = os.environ.get("KEY")
|
|
10 |
|
11 |
SPECIAL_SYMBOLS = ["⠀", "⠀"] # ["‹", "›"] ['"', '"']
|
12 |
|
|
|
|
|
13 |
DEFAULT_INPUT = "User: Hi!"
|
14 |
DEFAULT_WRAP = "Statical: %s"
|
15 |
DEFAULT_INSTRUCTION = "Statical is a helpful chatbot who is communicating with people."
|
@@ -38,7 +40,7 @@ def format(instruction, history, input, wrap):
|
|
38 |
return f"{formatted_input}{wrapped_input}", formatted_input
|
39 |
|
40 |
def predict(access_key, instruction, history, input, wrap, model, temperature, top_p, top_k, rep_p, max_tokens, stop_seqs, seed):
|
41 |
-
|
42 |
if (access_key != KEY):
|
43 |
print(">>> MODEL FAILED: Input: " + input + ", Attempted Key: " + access_key)
|
44 |
return ("[UNAUTHORIZED ACCESS]", input, []);
|
@@ -110,13 +112,13 @@ with gr.Blocks() as demo:
|
|
110 |
cloud = gr.Button("☁️")
|
111 |
|
112 |
with gr.Column():
|
113 |
-
model = gr.
|
114 |
temperature = gr.Slider( minimum = 0, maximum = 2, value = 1, step = 0.01, interactive = True, label = "Temperature" )
|
115 |
top_p = gr.Slider( minimum = 0.01, maximum = 0.99, value = 0.95, step = 0.01, interactive = True, label = "Top P" )
|
116 |
top_k = gr.Slider( minimum = 1, maximum = 2048, value = 50, step = 1, interactive = True, label = "Top K" )
|
117 |
rep_p = gr.Slider( minimum = 0.01, maximum = 2, value = 1.2, step = 0.01, interactive = True, label = "Repetition Penalty" )
|
118 |
max_tokens = gr.Slider( minimum = 1, maximum = 2048, value = 32, step = 64, interactive = True, label = "Max New Tokens" )
|
119 |
-
stop_seqs = gr.Textbox(label = "Stop Sequences ( JSON Array / 4 Max )"
|
120 |
seed = gr.Slider( minimum = 0, maximum = 9007199254740991, value = 42, step = 1, interactive = True, label = "Seed" )
|
121 |
|
122 |
with gr.Row():
|
|
|
10 |
|
11 |
SPECIAL_SYMBOLS = ["⠀", "⠀"] # ["‹", "›"] ['"', '"']
|
12 |
|
13 |
+
DEFAULT_MODEL = "Falcon"
|
14 |
+
|
15 |
DEFAULT_INPUT = "User: Hi!"
|
16 |
DEFAULT_WRAP = "Statical: %s"
|
17 |
DEFAULT_INSTRUCTION = "Statical is a helpful chatbot who is communicating with people."
|
|
|
40 |
return f"{formatted_input}{wrapped_input}", formatted_input
|
41 |
|
42 |
def predict(access_key, instruction, history, input, wrap, model, temperature, top_p, top_k, rep_p, max_tokens, stop_seqs, seed):
|
43 |
+
|
44 |
if (access_key != KEY):
|
45 |
print(">>> MODEL FAILED: Input: " + input + ", Attempted Key: " + access_key)
|
46 |
return ("[UNAUTHORIZED ACCESS]", input, []);
|
|
|
112 |
cloud = gr.Button("☁️")
|
113 |
|
114 |
with gr.Column():
|
115 |
+
model = gr.Textbox( value = DEFAULT_MODEL, interactive = True, label = "Model" )
|
116 |
temperature = gr.Slider( minimum = 0, maximum = 2, value = 1, step = 0.01, interactive = True, label = "Temperature" )
|
117 |
top_p = gr.Slider( minimum = 0.01, maximum = 0.99, value = 0.95, step = 0.01, interactive = True, label = "Top P" )
|
118 |
top_k = gr.Slider( minimum = 1, maximum = 2048, value = 50, step = 1, interactive = True, label = "Top K" )
|
119 |
rep_p = gr.Slider( minimum = 0.01, maximum = 2, value = 1.2, step = 0.01, interactive = True, label = "Repetition Penalty" )
|
120 |
max_tokens = gr.Slider( minimum = 1, maximum = 2048, value = 32, step = 64, interactive = True, label = "Max New Tokens" )
|
121 |
+
stop_seqs = gr.Textbox( value = DEFAULT_STOPS, interactive = True, label = "Stop Sequences ( JSON Array / 4 Max )" )
|
122 |
seed = gr.Slider( minimum = 0, maximum = 9007199254740991, value = 42, step = 1, interactive = True, label = "Seed" )
|
123 |
|
124 |
with gr.Row():
|