Spaces:
Build error
Build error
jcarbonnell
commited on
Commit
·
69ebead
1
Parent(s):
b938b9c
Update app.py
Browse files
app.py
CHANGED
@@ -21,22 +21,14 @@ if choice == 'NFT':
|
|
21 |
if st.button("Generate"):
|
22 |
prompt = "<|startoftext|>"
|
23 |
generated = torch.tensor(tokenizer.encode(prompt)).unsqueeze(0)
|
24 |
-
|
25 |
-
|
26 |
-
do_sample=True,
|
27 |
-
top_k=50,
|
28 |
-
max_length = 512,
|
29 |
-
top_p=0.95,
|
30 |
-
num_return_sequences=1
|
31 |
-
)
|
32 |
-
for i, sample_output in enumerate(sample_outputs):
|
33 |
-
generated_text = tokenizer.decode(sample_output, skip_special_tokens=True)
|
34 |
summary = summarize(generated_text, num_sentences=1)
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
else:
|
41 |
st.write("Topic not available yet")
|
42 |
|
|
|
21 |
if st.button("Generate"):
|
22 |
prompt = "<|startoftext|>"
|
23 |
generated = torch.tensor(tokenizer.encode(prompt)).unsqueeze(0)
|
24 |
+
output = model.generate(generated, do_sample=True, top_k=50, max_length = 512, top_p=0.95, num_return_sequences=1)
|
25 |
+
generated_text = tokenizer.decode(output, skip_special_tokens=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
summary = summarize(generated_text, num_sentences=1)
|
27 |
|
28 |
+
#st.text("Keywords: {}\n".format(keywords))
|
29 |
+
#st.text("Length in number of words: {}\n".format(length))
|
30 |
+
st.text("This is your tailored blog article:", generated_text)
|
31 |
+
st.text("This is a tweet-sized summary of your article: ", summary)
|
32 |
else:
|
33 |
st.write("Topic not available yet")
|
34 |
|