Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -47,18 +47,20 @@ def generate(query: str, temperature=0.9, max_new_tokens=256, top_p=0.95, repeti
|
|
47 |
seed=42,
|
48 |
)
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
62 |
|
63 |
|
64 |
def process_example(**krwags):
|
|
|
47 |
seed=42,
|
48 |
)
|
49 |
|
50 |
+
try:
|
51 |
+
stream = client.generate_stream(prompt, **generate_kwargs)
|
52 |
+
output = ""
|
53 |
+
previous_token = ""
|
54 |
+
for response in stream:
|
55 |
+
if response.token.text == "<|endoftext|>":
|
56 |
+
return output
|
57 |
+
else:
|
58 |
+
output += response.token.text
|
59 |
+
previous_token = response.token.text
|
60 |
+
yield output
|
61 |
+
return output
|
62 |
+
except errors.UnknownError:
|
63 |
+
return "Please wait for a while, The OctoCoder model is currently loading... π"
|
64 |
|
65 |
|
66 |
def process_example(**krwags):
|