Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -16,9 +16,9 @@ client = anthropic.Anthropic(api_key=api_key)
|
|
16 |
def generate_game_environment(environment_description):
|
17 |
message = client.messages.create(
|
18 |
model="claude-3-5-sonnet-20240620",
|
19 |
-
max_tokens=
|
20 |
temperature=0.7,
|
21 |
-
system="You are
|
22 |
messages=[
|
23 |
{
|
24 |
"role": "user",
|
@@ -36,7 +36,7 @@ def generate_game_environment(environment_description):
|
|
36 |
def generate_protagonist(protagonist_description):
|
37 |
message = client.messages.create(
|
38 |
model="claude-3-5-sonnet-20240620",
|
39 |
-
max_tokens=
|
40 |
temperature=0.7,
|
41 |
system="You are an expert in character creation. Generate a detailed description of a game protagonist based on the input.",
|
42 |
messages=[
|
@@ -56,7 +56,7 @@ def generate_protagonist(protagonist_description):
|
|
56 |
def generate_antagonist(antagonist_description):
|
57 |
message = client.messages.create(
|
58 |
model="claude-3-5-sonnet-20240620",
|
59 |
-
max_tokens=
|
60 |
temperature=0.7,
|
61 |
system="You are an expert in villain creation. Generate a detailed description of a game antagonist based on the input.",
|
62 |
messages=[
|
@@ -80,7 +80,7 @@ def generate_game_story(environment, protagonist, antagonist):
|
|
80 |
f"Antagonist: {antagonist}")
|
81 |
message = client.messages.create(
|
82 |
model="claude-3-5-sonnet-20240620",
|
83 |
-
max_tokens=
|
84 |
temperature=0.7,
|
85 |
system="You are a master storyteller. Generate a detailed game story based on the inputs provided.",
|
86 |
messages=[
|
@@ -98,17 +98,30 @@ def generate_game_story(environment, protagonist, antagonist):
|
|
98 |
return message.content[0].text
|
99 |
|
100 |
# App Title
|
101 |
-
st.title("Story
|
102 |
|
103 |
# App Description
|
104 |
-
st.write("Story
|
105 |
|
106 |
# Sidebar Inputs
|
107 |
with st.sidebar:
|
108 |
st.header("π Game Details")
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
if st.button("Generate Document π¨οΈ"):
|
113 |
# Generate content based on user input
|
114 |
env_description = generate_game_environment(game_environment)
|
|
|
16 |
def generate_game_environment(environment_description):
|
17 |
message = client.messages.create(
|
18 |
model="claude-3-5-sonnet-20240620",
|
19 |
+
max_tokens=400,
|
20 |
temperature=0.7,
|
21 |
+
system="You are an expert in world-building. Generate a detailed description of a game environment based on the input.",
|
22 |
messages=[
|
23 |
{
|
24 |
"role": "user",
|
|
|
36 |
def generate_protagonist(protagonist_description):
|
37 |
message = client.messages.create(
|
38 |
model="claude-3-5-sonnet-20240620",
|
39 |
+
max_tokens=400,
|
40 |
temperature=0.7,
|
41 |
system="You are an expert in character creation. Generate a detailed description of a game protagonist based on the input.",
|
42 |
messages=[
|
|
|
56 |
def generate_antagonist(antagonist_description):
|
57 |
message = client.messages.create(
|
58 |
model="claude-3-5-sonnet-20240620",
|
59 |
+
max_tokens=400,
|
60 |
temperature=0.7,
|
61 |
system="You are an expert in villain creation. Generate a detailed description of a game antagonist based on the input.",
|
62 |
messages=[
|
|
|
80 |
f"Antagonist: {antagonist}")
|
81 |
message = client.messages.create(
|
82 |
model="claude-3-5-sonnet-20240620",
|
83 |
+
max_tokens=400,
|
84 |
temperature=0.7,
|
85 |
system="You are a master storyteller. Generate a detailed game story based on the inputs provided.",
|
86 |
messages=[
|
|
|
98 |
return message.content[0].text
|
99 |
|
100 |
# App Title
|
101 |
+
st.title("Story Fabricator π οΈ")
|
102 |
|
103 |
# App Description
|
104 |
+
st.write("Story Fabricator helps game developers generate comprehensive Game Design Documents. Input details about your game environment, protagonist, and antagonist to create a structured design document.")
|
105 |
|
106 |
# Sidebar Inputs
|
107 |
with st.sidebar:
|
108 |
st.header("π Game Details")
|
109 |
+
|
110 |
+
# Game Environment Input
|
111 |
+
st.subheader("π Game Environment")
|
112 |
+
st.write("Set the foundation for the game world by providing a detailed and imaginative description of the overall theme, setting, and gameplay elements.")
|
113 |
+
game_environment = st.text_area("Game Environment", "Describe the setting of your game", height=150)
|
114 |
+
|
115 |
+
# Protagonist Input
|
116 |
+
st.subheader("π¦Έ Protagonist")
|
117 |
+
st.write("Introduce the main character of the game. Describe their appearance, personality, strengths, and weaknesses. What makes them unique and interesting?")
|
118 |
+
protagonist = st.text_area("Protagonist", "Describe the main character", height=150)
|
119 |
+
|
120 |
+
# Antagonist Input
|
121 |
+
st.subheader("πΉ Antagonist")
|
122 |
+
st.write("Describe the primary antagonist or enemy in the game. What are their motivations, abilities, and characteristics? How do they pose a challenge to the protagonist?")
|
123 |
+
antagonist = st.text_area("Antagonist", "Describe the main villain or opposing force", height=150)
|
124 |
+
|
125 |
if st.button("Generate Document π¨οΈ"):
|
126 |
# Generate content based on user input
|
127 |
env_description = generate_game_environment(game_environment)
|