Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -30,13 +30,12 @@ Dialogue:
|
|
30 |
|
31 |
What was going on?
|
32 |
"""
|
33 |
-
generation_config = GenerationConfig(max_new_tokens=80, do_sample=True, temperature=0.5)
|
34 |
|
35 |
inputs = tokenizer(prompt, return_tensors='pt')
|
36 |
output = tokenizer.decode(
|
37 |
model.generate(
|
38 |
inputs["input_ids"],
|
39 |
-
|
40 |
)[0],
|
41 |
skip_special_tokens=True
|
42 |
)
|
@@ -73,13 +72,12 @@ What was going on?
|
|
73 |
|
74 |
# this is for one_shot
|
75 |
def one_shot(example_indices_full,my_example):
|
76 |
-
generation_config = GenerationConfig(max_new_tokens=80, do_sample=True, temperature=0.5)
|
77 |
|
78 |
inputs = tokenizer(my_prompt(example_indices_full,my_example), return_tensors='pt')
|
79 |
output = tokenizer.decode(
|
80 |
model.generate(
|
81 |
inputs["input_ids"],
|
82 |
-
|
83 |
)[0],
|
84 |
skip_special_tokens=True
|
85 |
)
|
@@ -87,12 +85,11 @@ def one_shot(example_indices_full,my_example):
|
|
87 |
|
88 |
# few_shot
|
89 |
def few_shot(example_indices_full_few_shot,my_example):
|
90 |
-
generation_config = GenerationConfig(max_new_tokens=80, do_sample=True, temperature=0.5)
|
91 |
inputs = tokenizer(my_prompt(example_indices_full_few_shot,my_example), return_tensors='pt')
|
92 |
output = tokenizer.decode(
|
93 |
model.generate(
|
94 |
inputs["input_ids"],
|
95 |
-
|
96 |
)[0],
|
97 |
skip_special_tokens=True
|
98 |
)
|
@@ -100,7 +97,7 @@ def few_shot(example_indices_full_few_shot,my_example):
|
|
100 |
|
101 |
st.title("Google FLAN-T5(Base) Prompt Engineered Model: Zero-shot, Single-shot, and Few-shot")
|
102 |
|
103 |
-
my_example = st.text_area("Enter dialogues to summarize", value="
|
104 |
|
105 |
if st.button("Run"):
|
106 |
zero_shot_output = zero_shot(my_example)
|
|
|
30 |
|
31 |
What was going on?
|
32 |
"""
|
|
|
33 |
|
34 |
inputs = tokenizer(prompt, return_tensors='pt')
|
35 |
output = tokenizer.decode(
|
36 |
model.generate(
|
37 |
inputs["input_ids"],
|
38 |
+
max_new_tokens=80,
|
39 |
)[0],
|
40 |
skip_special_tokens=True
|
41 |
)
|
|
|
72 |
|
73 |
# this is for one_shot
|
74 |
def one_shot(example_indices_full,my_example):
|
|
|
75 |
|
76 |
inputs = tokenizer(my_prompt(example_indices_full,my_example), return_tensors='pt')
|
77 |
output = tokenizer.decode(
|
78 |
model.generate(
|
79 |
inputs["input_ids"],
|
80 |
+
max_new_tokens=80,
|
81 |
)[0],
|
82 |
skip_special_tokens=True
|
83 |
)
|
|
|
85 |
|
86 |
# few_shot
|
87 |
def few_shot(example_indices_full_few_shot,my_example):
|
|
|
88 |
inputs = tokenizer(my_prompt(example_indices_full_few_shot,my_example), return_tensors='pt')
|
89 |
output = tokenizer.decode(
|
90 |
model.generate(
|
91 |
inputs["input_ids"],
|
92 |
+
max_new_tokens=80,
|
93 |
)[0],
|
94 |
skip_special_tokens=True
|
95 |
)
|
|
|
97 |
|
98 |
st.title("Google FLAN-T5(Base) Prompt Engineered Model: Zero-shot, Single-shot, and Few-shot")
|
99 |
|
100 |
+
my_example = st.text_area("Enter dialogues to summarize", value="Maaz: Jalal how are you?\nJalal: I am good thank you.\nMaaz: Are you going to school tomorrow.\nJalal: No bro i am not going to school tomorrow.\nMaaz: why?\nJalal: I am working on a project, are you want to work with me on my project?\nMaaz: sorry, i have to go to school.")
|
101 |
|
102 |
if st.button("Run"):
|
103 |
zero_shot_output = zero_shot(my_example)
|