Update app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,10 @@ def text_generation(keywords, domain):
|
|
11 |
torch.manual_seed(random.randint(0,18446744073709551615))
|
12 |
outputs = model.generate(input_ids, do_sample=True, min_length=50, max_length=250)
|
13 |
generated_text = tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
14 |
-
|
|
|
|
|
|
|
15 |
|
16 |
title = "TDK GPT2"
|
17 |
description = "Title and description generation by keywords"
|
|
|
11 |
torch.manual_seed(random.randint(0,18446744073709551615))
|
12 |
outputs = model.generate(input_ids, do_sample=True, min_length=50, max_length=250)
|
13 |
generated_text = tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
14 |
+
title_description_arr = generated_text.split(' title ')[1].split('description')
|
15 |
+
title = title_description_arr[0].strip()
|
16 |
+
description = title_description_arr[1].strip()
|
17 |
+
return title + "\r\n" + description
|
18 |
|
19 |
title = "TDK GPT2"
|
20 |
description = "Title and description generation by keywords"
|