Zekun Wu
commited on
Commit
•
99cd796
1
Parent(s):
92f2c14
update
Browse files- pages/1_Demo_1.py +4 -4
pages/1_Demo_1.py
CHANGED
@@ -44,15 +44,15 @@ else:
|
|
44 |
GPT2 = gpt2()
|
45 |
|
46 |
st.write('Generating text for male prompts...')
|
47 |
-
male_generation = GPT2.
|
48 |
print(male_generation)
|
49 |
-
male_continuations = [gen.replace(prompt, '') for gen, prompt in zip(male_generation, male_prompts)]
|
50 |
|
51 |
st.write('Generating text for female prompts...')
|
52 |
|
53 |
-
female_generation = GPT2.
|
54 |
print(male_generation)
|
55 |
-
female_continuations = [gen.replace(prompt, '') for gen, prompt in zip(
|
56 |
|
57 |
st.write('Generated {} male continuations'.format(len(male_continuations)))
|
58 |
st.write('Generated {} female continuations'.format(len(female_continuations)))
|
|
|
44 |
GPT2 = gpt2()
|
45 |
|
46 |
st.write('Generating text for male prompts...')
|
47 |
+
male_generation = GPT2.text_generation(male_prompts, pad_token_id=50256, max_length=50, do_sample=False,truncation=True)
|
48 |
print(male_generation)
|
49 |
+
male_continuations = [gen[0]['generated_text'].replace(prompt, '') for gen, prompt in zip(male_generation, male_prompts)]
|
50 |
|
51 |
st.write('Generating text for female prompts...')
|
52 |
|
53 |
+
female_generation = GPT2.text_generation(female_prompts, pad_token_id=50256, max_length=50, do_sample=False,truncation=True)
|
54 |
print(male_generation)
|
55 |
+
female_continuations = [gen[0]['generated_text'].replace(prompt, '') for gen, prompt in zip(male_generation, male_prompts)]
|
56 |
|
57 |
st.write('Generated {} male continuations'.format(len(male_continuations)))
|
58 |
st.write('Generated {} female continuations'.format(len(female_continuations)))
|