Spaces:
Sleeping
Sleeping
un-index
commited on
Commit
·
c249a9b
1
Parent(s):
117e325
app.py
CHANGED
|
@@ -105,9 +105,10 @@ def f(context, temperature, top_p, max_length, model_idx, SPACE_VERIFICATION_KEY
|
|
| 105 |
# for this api, a length of > 250 instantly errors, so use a while loop or something
|
| 106 |
# that would fetch results in chunks of 250
|
| 107 |
# NOTE change so it uses previous generated input every time
|
| 108 |
-
generated_text = context #""
|
| 109 |
while (max_length > 0):
|
| 110 |
-
|
|
|
|
| 111 |
response = requests.request("POST", API_URL, data=json.dumps(payload), headers=headers)
|
| 112 |
context = json.loads(response.content.decode("utf-8"))#[0]['generated_text']
|
| 113 |
# context = get_generated_text(generated_context)
|
|
|
|
| 105 |
# for this api, a length of > 250 instantly errors, so use a while loop or something
|
| 106 |
# that would fetch results in chunks of 250
|
| 107 |
# NOTE change so it uses previous generated input every time
|
| 108 |
+
generated_text = ""#context #""
|
| 109 |
while (max_length > 0):
|
| 110 |
+
# context becomes the previous generated context
|
| 111 |
+
payload = {"inputs": context, "parameters": {"max_new_tokens": max_length>250 and 250 or max_length, "temperature": temperature, "top_p": top_p}}
|
| 112 |
response = requests.request("POST", API_URL, data=json.dumps(payload), headers=headers)
|
| 113 |
context = json.loads(response.content.decode("utf-8"))#[0]['generated_text']
|
| 114 |
# context = get_generated_text(generated_context)
|