Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,13 +12,13 @@ with open("name.txt", "r") as f:
|
|
12 |
def generate(starting_text):
|
13 |
seed = random.randint(1, 100000)
|
14 |
set_seed(seed)
|
15 |
-
|
16 |
# If the text field is empty
|
17 |
if starting_text == "":
|
18 |
-
starting_text: str = line[random.randrange(0, len(line))]
|
19 |
starting_text: str = re.sub(r"[,:\-–.!;?_]", '', starting_text)
|
20 |
print(starting_text)
|
21 |
-
|
22 |
response = gpt2_pipe(starting_text, max_length=random.randint(20, 45), num_return_sequences=random.randint(5, 15))
|
23 |
response_list = []
|
24 |
for x in response:
|
|
|
12 |
def generate(starting_text):
|
13 |
seed = random.randint(1, 100000)
|
14 |
set_seed(seed)
|
15 |
+
|
16 |
# If the text field is empty
|
17 |
if starting_text == "":
|
18 |
+
starting_text: str = line[random.randrange(0, len(line))].replace("\n", "")
|
19 |
starting_text: str = re.sub(r"[,:\-–.!;?_]", '', starting_text)
|
20 |
print(starting_text)
|
21 |
+
|
22 |
response = gpt2_pipe(starting_text, max_length=random.randint(20, 45), num_return_sequences=random.randint(5, 15))
|
23 |
response_list = []
|
24 |
for x in response:
|