Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -17,10 +17,16 @@ def generate(tokenizer, model, text, features):
|
|
17 |
)
|
18 |
decoded = tokenizer.decode(sample_outputs[0], skip_special_tokens=False)
|
19 |
print(decoded, file=sys.stderr)
|
20 |
-
if '<|authornameend|>' not in decoded:
|
21 |
-
continue
|
22 |
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
count += 1
|
26 |
st.markdown('**' + author.strip() + '**: ' + text.replace('<|endoftext|>', '').replace('<|pad|>', '').strip())
|
|
|
17 |
)
|
18 |
decoded = tokenizer.decode(sample_outputs[0], skip_special_tokens=False)
|
19 |
print(decoded, file=sys.stderr)
|
|
|
|
|
20 |
|
21 |
+
if '<|authornamebegin|>' not in decoded:
|
22 |
+
continue
|
23 |
+
|
24 |
+
raw = decoded.split('<|authornamebegin|>')[-1]
|
25 |
+
|
26 |
+
if '<|authornameend|>' not in raw:
|
27 |
+
continue
|
28 |
+
|
29 |
+
author, text = raw.split('<|authornameend|>')
|
30 |
|
31 |
count += 1
|
32 |
st.markdown('**' + author.strip() + '**: ' + text.replace('<|endoftext|>', '').replace('<|pad|>', '').strip())
|