Spaces:
Running
Running
Peter
commited on
Commit
·
cad1c1a
1
Parent(s):
4f5263b
format
Browse files
app.py
CHANGED
@@ -72,7 +72,8 @@ def generate_text(
|
|
72 |
formatted_email = postprocess(response)
|
73 |
return formatted_email, make_email_link(body=formatted_email)
|
74 |
|
75 |
-
|
|
|
76 |
"""
|
77 |
load_emailgen_model - load a text generation pipeline for email generation
|
78 |
|
@@ -89,6 +90,7 @@ def load_emailgen_model(model_tag:str):
|
|
89 |
device=0 if use_gpu else -1,
|
90 |
)
|
91 |
|
|
|
92 |
def get_parser():
|
93 |
"""
|
94 |
get_parser - a helper function for the argparse module
|
@@ -115,7 +117,7 @@ def get_parser():
|
|
115 |
)
|
116 |
|
117 |
parser.add_argument(
|
118 |
-
|
119 |
"--num_beams",
|
120 |
type=int,
|
121 |
default=4,
|
@@ -136,7 +138,11 @@ Hello,
|
|
136 |
|
137 |
Following up on last week's bubblegum shipment, I"""
|
138 |
|
139 |
-
available_models = [
|
|
|
|
|
|
|
|
|
140 |
|
141 |
if __name__ == "__main__":
|
142 |
logging.info("\n\n\nStarting new instance of app.py")
|
@@ -206,8 +212,8 @@ if __name__ == "__main__":
|
|
206 |
value=model_tag,
|
207 |
)
|
208 |
load_model_button = gr.Button(
|
209 |
-
|
210 |
-
variant=
|
211 |
)
|
212 |
num_beams = gr.Radio(
|
213 |
choices=[4, 8, 12, 16],
|
|
|
72 |
formatted_email = postprocess(response)
|
73 |
return formatted_email, make_email_link(body=formatted_email)
|
74 |
|
75 |
+
|
76 |
+
def load_emailgen_model(model_tag: str):
|
77 |
"""
|
78 |
load_emailgen_model - load a text generation pipeline for email generation
|
79 |
|
|
|
90 |
device=0 if use_gpu else -1,
|
91 |
)
|
92 |
|
93 |
+
|
94 |
def get_parser():
|
95 |
"""
|
96 |
get_parser - a helper function for the argparse module
|
|
|
117 |
)
|
118 |
|
119 |
parser.add_argument(
|
120 |
+
"-nb",
|
121 |
"--num_beams",
|
122 |
type=int,
|
123 |
default=4,
|
|
|
138 |
|
139 |
Following up on last week's bubblegum shipment, I"""
|
140 |
|
141 |
+
available_models = [
|
142 |
+
"postbot/distilgpt2-emailgen-V2",
|
143 |
+
"postbot/distilgpt2-emailgen",
|
144 |
+
"postbot/gpt2-medium-emailgen",
|
145 |
+
]
|
146 |
|
147 |
if __name__ == "__main__":
|
148 |
logging.info("\n\n\nStarting new instance of app.py")
|
|
|
212 |
value=model_tag,
|
213 |
)
|
214 |
load_model_button = gr.Button(
|
215 |
+
"Load Model",
|
216 |
+
variant="secondary",
|
217 |
)
|
218 |
num_beams = gr.Radio(
|
219 |
choices=[4, 8, 12, 16],
|
utils.py
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
import logging
|
5 |
import re
|
6 |
|
|
|
7 |
def postprocess(text: str):
|
8 |
"""
|
9 |
postprocess - remove common values in scraped dataset
|
|
|
4 |
import logging
|
5 |
import re
|
6 |
|
7 |
+
|
8 |
def postprocess(text: str):
|
9 |
"""
|
10 |
postprocess - remove common values in scraped dataset
|