Update maker.py
Browse files
maker.py
CHANGED
|
@@ -69,33 +69,23 @@ def post_request_beta(payload):
|
|
| 69 |
response.raise_for_status() # Will raise an HTTPError if the HTTP request returned an unsuccessful status code
|
| 70 |
return response.json()
|
| 71 |
|
| 72 |
-
|
| 73 |
-
def predict_beta(message, chatbot=[], system_prompt=system_prompt):
|
| 74 |
client = Client(tulu)
|
| 75 |
|
| 76 |
try:
|
| 77 |
-
# Adjust these parameters as needed
|
| 78 |
-
max_new_tokens = 1200
|
| 79 |
-
temperature = 0.4
|
| 80 |
-
top_p = 0.9
|
| 81 |
-
repetition_penalty = 0.5
|
| 82 |
-
advanced = False
|
| 83 |
-
|
| 84 |
-
# Making the prediction
|
| 85 |
result = client.predict(
|
| 86 |
-
message,
|
| 87 |
-
system_prompt,
|
| 88 |
-
max_new_tokens,
|
| 89 |
-
temperature,
|
| 90 |
-
top_p,
|
| 91 |
-
repetition_penalty,
|
| 92 |
-
advanced,
|
| 93 |
fn_index=0
|
| 94 |
)
|
| 95 |
|
| 96 |
-
# Extracting the response
|
| 97 |
if result is not None and len(result) > 0:
|
| 98 |
-
bot_message = result[0]
|
| 99 |
return bot_message
|
| 100 |
else:
|
| 101 |
raise gr.Error("No response received from the model.")
|
|
|
|
| 69 |
response.raise_for_status() # Will raise an HTTPError if the HTTP request returned an unsuccessful status code
|
| 70 |
return response.json()
|
| 71 |
|
| 72 |
+
def predict_beta(message, chatbot=[], system_prompt=system_prompt, max_new_tokens=1200, temperature=0.4, top_p=0.9, repetition_penalty=0.5, advanced=False):
|
|
|
|
| 73 |
client = Client(tulu)
|
| 74 |
|
| 75 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
result = client.predict(
|
| 77 |
+
message,
|
| 78 |
+
system_prompt,
|
| 79 |
+
max_new_tokens,
|
| 80 |
+
temperature,
|
| 81 |
+
top_p,
|
| 82 |
+
repetition_penalty,
|
| 83 |
+
advanced,
|
| 84 |
fn_index=0
|
| 85 |
)
|
| 86 |
|
|
|
|
| 87 |
if result is not None and len(result) > 0:
|
| 88 |
+
bot_message = result[0]
|
| 89 |
return bot_message
|
| 90 |
else:
|
| 91 |
raise gr.Error("No response received from the model.")
|