Skip to content

Commit

Permalink
fixed style
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-bay committed Dec 17, 2019
1 parent a2c52eb commit 21e24fe
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
1 change: 1 addition & 0 deletions generator/gpt2/gpt2_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import warnings

import numpy as np

import tensorflow as tf
from generator.gpt2.src import encoder, model, sample
from story.utils import *
Expand Down
1 change: 1 addition & 0 deletions generator/gpt2/src/model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np

import tensorflow as tf
from tensorflow.contrib.training import HParams

Expand Down
18 changes: 14 additions & 4 deletions play.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
import os
import sys
import random
import sys
import time

from generator.gpt2.gpt2_generator import *
Expand Down Expand Up @@ -102,7 +102,9 @@ def get_custom_prompt():
return context, prompt


def get_curated_exposition(setting_key, character_key, name, character, setting_description):
def get_curated_exposition(
setting_key, character_key, name, character, setting_description
):
name_token = "<NAME>"
if (
character_key == "noble"
Expand Down Expand Up @@ -178,13 +180,21 @@ def play_aidungeon_2():

if splash_choice == "new":
print("\n\n")
setting_key, character_key, name, character, setting_description = select_game()
(
setting_key,
character_key,
name,
character,
setting_description,
) = select_game()

if setting_key == "custom":
context, prompt = get_custom_prompt()

else:
context, prompt = get_curated_exposition(setting_key, character_key, name, character, setting_description)
context, prompt = get_curated_exposition(
setting_key, character_key, name, character, setting_description
)

console_print(instructions())
print("\nGenerating story...")
Expand Down
1 change: 0 additions & 1 deletion story/grammars/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ def direct(setting, key):
rules = load_rules(setting)
artefact = apply_grammar(key, rules)
return artefact

7 changes: 6 additions & 1 deletion story/story_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,12 @@ def save_to_storage(self):

FNULL = open(os.devnull, "w")
p = Popen(
["gsutil", "cp", os.path.join(save_path, file_name), "gs://aidungeonstories"],
[
"gsutil",
"cp",
os.path.join(save_path, file_name),
"gs://aidungeonstories",
],
stdout=FNULL,
stderr=subprocess.STDOUT,
)
Expand Down

0 comments on commit 21e24fe

Please sign in to comment.