Update app.py
Browse files
app.py
CHANGED
@@ -51,30 +51,6 @@ def render_card(card_dict):
|
|
51 |
card = card.replace("~", card_dict["name"])
|
52 |
return card
|
53 |
|
54 |
-
prompt="\u003C|type|>Creature - Human \u003C|name|>Rezo the Destroyer of Politics \u003C|manaCost|> 2 {B/G}" #@param {type:"string"}
|
55 |
-
temperature = 0.7 #@param {type:"slider", min:0.1, max:1.2, step:0.1}
|
56 |
-
to_file = False #@param {type:"boolean"}
|
57 |
-
|
58 |
-
n = 100 if to_file else 8
|
59 |
-
|
60 |
-
cards = ai.generate(n=n,
|
61 |
-
schema=True,
|
62 |
-
prompt=prompt,
|
63 |
-
temperature=temperature,
|
64 |
-
return_as_list=True)
|
65 |
-
|
66 |
-
cards = list(map(render_card, cards))
|
67 |
-
|
68 |
-
if to_file:
|
69 |
-
file_path = "cards.txt"
|
70 |
-
with open(file_path, "w", encoding="utf-8") as f:
|
71 |
-
for card in cards:
|
72 |
-
f.write("{}\n{}".format(card, "=" * 20 + "\n"))
|
73 |
-
if "google.colab" in sys.modules:
|
74 |
-
files.download(file_path)
|
75 |
-
else:
|
76 |
-
print(("\n" + "=" * 20 + "\n").join(cards))
|
77 |
-
|
78 |
def generate_cards(
|
79 |
n_cards: int = 8,
|
80 |
temperature: float = 0.75,
|
|
|
51 |
card = card.replace("~", card_dict["name"])
|
52 |
return card
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
def generate_cards(
|
55 |
n_cards: int = 8,
|
56 |
temperature: float = 0.75,
|