Spaces:
Runtime error
Runtime error
change max token range
Browse files
app.py
CHANGED
@@ -23,6 +23,7 @@ def respond(message, history, endpoint, token, temp, max_token=0):
|
|
23 |
}
|
24 |
q = {"inputs": {"prompt": ["Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n" +
|
25 |
message + "\n\n### Response:\n"], "max_tokens": [int(max_token)], "temperature": [int(temp)]}}
|
|
|
26 |
try:
|
27 |
response = requests.post(local_endpoint, json=q, headers=headers, timeout=100)
|
28 |
response_data = response.json(
|
@@ -31,6 +32,7 @@ def respond(message, history, endpoint, token, temp, max_token=0):
|
|
31 |
response_data = "ERROR status_code:" + \
|
32 |
str(response.status_code) + " response:" + response.text
|
33 |
|
|
|
34 |
return custom_message + response_data
|
35 |
|
36 |
|
@@ -53,7 +55,7 @@ demo = gr.ChatInterface(
|
|
53 |
gr.Textbox(label="Custom Token", type="password",
|
54 |
placeholder="dapiXXXXXXXXXX"),
|
55 |
gr.Slider(0, 100, label="Temp", value=0),
|
56 |
-
gr.Slider(
|
57 |
],
|
58 |
additional_inputs_accordion_name="Settings"
|
59 |
)
|
|
|
23 |
}
|
24 |
q = {"inputs": {"prompt": ["Below is an instruction that describes a task. Write a response that appropriately completes the request.\n\n### Instruction:\n" +
|
25 |
message + "\n\n### Response:\n"], "max_tokens": [int(max_token)], "temperature": [int(temp)]}}
|
26 |
+
#print(q)
|
27 |
try:
|
28 |
response = requests.post(local_endpoint, json=q, headers=headers, timeout=100)
|
29 |
response_data = response.json(
|
|
|
32 |
response_data = "ERROR status_code:" + \
|
33 |
str(response.status_code) + " response:" + response.text
|
34 |
|
35 |
+
#print(response.json())
|
36 |
return custom_message + response_data
|
37 |
|
38 |
|
|
|
55 |
gr.Textbox(label="Custom Token", type="password",
|
56 |
placeholder="dapiXXXXXXXXXX"),
|
57 |
gr.Slider(0, 100, label="Temp", value=0),
|
58 |
+
gr.Slider(1, 300, label="Max token", value=75)
|
59 |
],
|
60 |
additional_inputs_accordion_name="Settings"
|
61 |
)
|