-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
49 lines (45 loc) · 1.57 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from constants import events, interlude, prologue, epilogue
# from PIL import Image
# from sd import generate_scene
import thisllm
from not_used.charac import Character
model = thisllm.LLM_Model()
import os
cwd = os.getcwd()
characters = {}
characters["interlude"] = Character("Interlude", interlude)
characters["prologue"] = Character("Prologue", prologue)
characters["epilogue"] = Character("Epilogue", epilogue)
def display_menu(items):
mapping = {}
for choice, result in items:
mapping[choice] = result
print(choice)
answer = input()
return list(mapping.values())[int(answer)]
for event in events:
description = event["description"]
print(description)
# img = generate_scene(event["scene"])
# img.save(f'{cwd}/static/scene.png')
items = []
for choice, result in event["choices"].items():
oneChoice = (choice, result)
items.append(oneChoice)
result = display_menu(items)
char = result["character"].lower()
print(result["stable_diffusion_prompt"])
model.begin_conv(result["llm_prompt"] + characters[char].personality, characters[char].affection, char)
while True:
# img = generate_scene(result["stable_diffusion_prompt"])
# img.save(f'{cwd}/static/gameplay.png')
player_input = input()
# print("done generating")
output = model.respond(player_input)
print(output)
if_end = model.check_stats()
if if_end["end"]:
break
summary = model.end_conv()
characters[char].affection = summary["affection"]
characters[char].awareness += 1