Safwanahmad619 commited on
Commit
34e2755
ยท
verified ยท
1 Parent(s): c21aec9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -197
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  # import os
2
  # import streamlit as st
3
  # import anthropic
@@ -80,7 +81,7 @@
80
  # f"Antagonist: {antagonist}")
81
  # message = client.messages.create(
82
  # model="claude-3-5-sonnet-20240620",
83
- # max_tokens= 150,
84
  # temperature=0.7,
85
  # system="You are a master storyteller. Generate a detailed game story based on the inputs provided.",
86
  # messages=[
@@ -101,7 +102,7 @@
101
  # st.title("๐ŸŽฎ Safwan's GameMaker Studio")
102
 
103
  # # App Description
104
- # st.write("Welcome to Safwan's GameMaker Studio, a popular game development platform known for its ease of use and powerful features. Enter your ideas according to your taste and this will generate a script with real scenario. Generate more ideas to compete with the big communities.")
105
 
106
  # # Sidebar Inputs
107
  # with st.sidebar:
@@ -122,8 +123,8 @@
122
  # st.session_state.antagonist_description = antagonist_description
123
  # st.session_state.game_story = game_story
124
 
125
- # # Layout with two columns
126
- # col1, col2 = st.columns(2)
127
 
128
  # with col1:
129
  # st.header("๐ŸŒ Game Environment")
@@ -131,216 +132,38 @@
131
  # st.write(st.session_state.env_description)
132
  # else:
133
  # st.write(game_environment)
 
134
 
135
  # with col2:
136
- # st.header("๐Ÿ“– Game Story")
137
- # if 'game_story' in st.session_state:
138
- # st.write(st.session_state.game_story)
139
- # else:
140
- # st.write("Your game story will be generated based on the inputs provided.")
141
-
142
- # with col1:
143
  # st.header("๐Ÿฆธโ€โ™‚๏ธ Protagonist")
144
  # if 'protagonist_description' in st.session_state:
145
  # st.write(st.session_state.protagonist_description)
146
  # else:
147
  # st.write(protagonist)
 
148
 
149
- # with col2:
150
  # st.header("๐Ÿฆนโ€โ™€๏ธ Antagonist")
151
  # if 'antagonist_description' in st.session_state:
152
  # st.write(st.session_state.antagonist_description)
153
  # else:
154
  # st.write(antagonist)
155
- #---------------------------------------------------------------------
156
- # import os
157
- # import streamlit as st
158
- # import anthropic
159
- # from dotenv import load_dotenv
160
 
161
- # # Load environment variables from .env file
162
- # load_dotenv()
 
 
 
 
 
 
 
163
 
164
- # # Retrieve the API key from environment variables
165
- # api_key = os.getenv("Claude_api_key")
166
-
167
- # # Initialize the Anthropic client with the API key
168
- # client = anthropic.Anthropic(api_key=api_key)
169
-
170
- # # Define the functions to generate content
171
- # def generate_game_environment(environment_description):
172
- # message = client.messages.create(
173
- # model="claude-3-5-sonnet-20240620",
174
- # max_tokens=150,
175
- # temperature=0.7,
176
- # system="You are an expert in world-building. Generate a detailed description of a game environment based on the input.",
177
- # messages=[
178
- # {
179
- # "role": "user",
180
- # "content": [
181
- # {
182
- # "type": "text",
183
- # "text": f"Create a detailed description of a game environment based on this input: {environment_description}"
184
- # }
185
- # ]
186
- # }
187
- # ]
188
- # )
189
- # return message.content[0].text
190
-
191
- # def generate_protagonist(protagonist_description):
192
- # message = client.messages.create(
193
- # model="claude-3-5-sonnet-20240620",
194
- # max_tokens=150,
195
- # temperature=0.7,
196
- # system="You are an expert in character creation. Generate a detailed description of a game protagonist based on the input.",
197
- # messages=[
198
- # {
199
- # "role": "user",
200
- # "content": [
201
- # {
202
- # "type": "text",
203
- # "text": f"Create a detailed description of a game protagonist based on this input: {protagonist_description}"
204
- # }
205
- # ]
206
- # }
207
- # ]
208
- # )
209
- # return message.content[0].text
210
 
211
- # def generate_antagonist(antagonist_description):
212
- # message = client.messages.create(
213
- # model="claude-3-5-sonnet-20240620",
214
- # max_tokens=150,
215
- # temperature=0.7,
216
- # system="You are an expert in villain creation. Generate a detailed description of a game antagonist based on the input.",
217
- # messages=[
218
- # {
219
- # "role": "user",
220
- # "content": [
221
- # {
222
- # "type": "text",
223
- # "text": f"Create a detailed description of a game antagonist based on this input: {antagonist_description}"
224
- # }
225
- # ]
226
- # }
227
- # ]
228
- # )
229
- # return message.content[0].text
230
 
231
- # def generate_game_story(environment, protagonist, antagonist):
232
- # story_prompt = (f"Create a detailed game story based on the following inputs:\n"
233
- # f"Game Environment: {environment}\n"
234
- # f"Protagonist: {protagonist}\n"
235
- # f"Antagonist: {antagonist}")
236
- # message = client.messages.create(
237
- # model="claude-3-5-sonnet-20240620",
238
- # max_tokens= 150,
239
- # temperature=0.7,
240
- # system="You are a master storyteller. Generate a detailed game story based on the inputs provided.",
241
- # messages=[
242
- # {
243
- # "role": "user",
244
- # "content": [
245
- # {
246
- # "type": "text",
247
- # "text": story_prompt
248
- # }
249
- # ]
250
- # }
251
- # ]
252
- # )
253
- # return message.content[0].text
254
-
255
- # def generate_scenario_and_script(environment, protagonist, antagonist):
256
- # scenario_prompt = (f"Create a scenario and script based on the following details:\n"
257
- # f"Game Environment: {environment}\n"
258
- # f"Protagonist: {protagonist}\n"
259
- # f"Antagonist: {antagonist}")
260
- # message = client.messages.create(
261
- # model="claude-3-5-sonnet-20240620",
262
- # max_tokens=200,
263
- # temperature=0.7,
264
- # system="You are an expert in game scenario and script writing. Generate a scenario and script based on the inputs provided.",
265
- # messages=[
266
- # {
267
- # "role": "user",
268
- # "content": [
269
- # {
270
- # "type": "text",
271
- # "text": scenario_prompt
272
- # }
273
- # ]
274
- # }
275
- # ]
276
- # )
277
- # return message.content[0].text
278
-
279
- # # App Title
280
- # st.title("๐ŸŽฎ StoryForge")
281
-
282
- # # App Description
283
- # st.write("StoryForge helps game developers generate comprehensive Game Design Documents. Input details about your game environment, protagonist, and antagonist to create a structured design document.")
284
-
285
- # # Sidebar Inputs
286
- # with st.sidebar:
287
- # st.header("๐Ÿ“ Game Details")
288
- # game_environment = st.text_input("๐Ÿž๏ธ Game Environment", "Describe the setting of your game")
289
- # protagonist = st.text_input("๐Ÿฆธโ€โ™‚๏ธ Protagonist", "Describe the main character")
290
- # antagonist = st.text_input("๐Ÿฆนโ€โ™€๏ธ Antagonist", "Describe the main villain or opposing force")
291
- # if st.button("Generate Document"):
292
- # # Generate content based on user input
293
- # env_description = generate_game_environment(game_environment)
294
- # protagonist_description = generate_protagonist(protagonist)
295
- # antagonist_description = generate_antagonist(antagonist)
296
- # game_story = generate_game_story(game_environment, protagonist, antagonist)
297
- # scenario_and_script = generate_scenario_and_script(env_description, protagonist_description, antagonist_description)
298
-
299
- # # Store results in session state
300
- # st.session_state.env_description = env_description
301
- # st.session_state.protagonist_description = protagonist_description
302
- # st.session_state.antagonist_description = antagonist_description
303
- # st.session_state.game_story = game_story
304
- # st.session_state.scenario_and_script = scenario_and_script
305
-
306
- # # Layout with three columns
307
- # col1, col2, col3 = st.columns(3)
308
-
309
- # with col1:
310
- # st.header("๐ŸŒ Game Environment")
311
- # if 'env_description' in st.session_state:
312
- # st.write(st.session_state.env_description)
313
- # else:
314
- # st.write(game_environment)
315
-
316
- # with col2:
317
- # st.header("๐Ÿ“– Game Story")
318
- # if 'game_story' in st.session_state:
319
- # st.write(st.session_state.game_story)
320
- # else:
321
- # st.write("Your game story will be generated based on the inputs provided.")
322
-
323
- # with col1:
324
- # st.header("๐Ÿฆธโ€โ™‚๏ธ Protagonist")
325
- # if 'protagonist_description' in st.session_state:
326
- # st.write(st.session_state.protagonist_description)
327
- # else:
328
- # st.write(protagonist)
329
-
330
- # with col2:
331
- # st.header("๐Ÿฆนโ€โ™€๏ธ Antagonist")
332
- # if 'antagonist_description' in st.session_state:
333
- # st.write(st.session_state.antagonist_description)
334
- # else:
335
- # st.write(antagonist)
336
-
337
- # with col3:
338
- # st.header("๐ŸŽฌ Scenario and Script")
339
- # if 'scenario_and_script' in st.session_state:
340
- # st.write(st.session_state.scenario_and_script)
341
- # else:
342
- # st.write("Your scenario and script will be generated based on the inputs provided.")
343
- #=-----------------------------------------------------
344
  import os
345
  import streamlit as st
346
  import anthropic
@@ -480,6 +303,11 @@ with col2:
480
  st.header("๐Ÿฆธโ€โ™‚๏ธ Protagonist")
481
  if 'protagonist_description' in st.session_state:
482
  st.write(st.session_state.protagonist_description)
 
 
 
 
 
483
  else:
484
  st.write(protagonist)
485
  st.markdown("---")
@@ -488,6 +316,11 @@ with col3:
488
  st.header("๐Ÿฆนโ€โ™€๏ธ Antagonist")
489
  if 'antagonist_description' in st.session_state:
490
  st.write(st.session_state.antagonist_description)
 
 
 
 
 
491
  else:
492
  st.write(antagonist)
493
  st.markdown("---")
 
1
+
2
  # import os
3
  # import streamlit as st
4
  # import anthropic
 
81
  # f"Antagonist: {antagonist}")
82
  # message = client.messages.create(
83
  # model="claude-3-5-sonnet-20240620",
84
+ # max_tokens=150,
85
  # temperature=0.7,
86
  # system="You are a master storyteller. Generate a detailed game story based on the inputs provided.",
87
  # messages=[
 
102
  # st.title("๐ŸŽฎ Safwan's GameMaker Studio")
103
 
104
  # # App Description
105
+ # st.write("Welcome to Safwan's GameMaker Studio, a popular game development platform known for its ease of use and powerful features. Enter your ideas according to your taste and this will generate a script with a real scenario. Generate more ideas to compete with the big communities.")
106
 
107
  # # Sidebar Inputs
108
  # with st.sidebar:
 
123
  # st.session_state.antagonist_description = antagonist_description
124
  # st.session_state.game_story = game_story
125
 
126
+ # # Layout with three columns
127
+ # col1, col2, col3 = st.columns(3)
128
 
129
  # with col1:
130
  # st.header("๐ŸŒ Game Environment")
 
132
  # st.write(st.session_state.env_description)
133
  # else:
134
  # st.write(game_environment)
135
+ # st.markdown("---")
136
 
137
  # with col2:
 
 
 
 
 
 
 
138
  # st.header("๐Ÿฆธโ€โ™‚๏ธ Protagonist")
139
  # if 'protagonist_description' in st.session_state:
140
  # st.write(st.session_state.protagonist_description)
141
  # else:
142
  # st.write(protagonist)
143
+ # st.markdown("---")
144
 
145
+ # with col3:
146
  # st.header("๐Ÿฆนโ€โ™€๏ธ Antagonist")
147
  # if 'antagonist_description' in st.session_state:
148
  # st.write(st.session_state.antagonist_description)
149
  # else:
150
  # st.write(antagonist)
151
+ # st.markdown("---")
 
 
 
 
152
 
153
+ # # Combine and merge sections to generate a scenario and script
154
+ # if 'env_description' in st.session_state and 'protagonist_description' in st.session_state and 'antagonist_description' in st.session_state:
155
+ # combined_content = (f"### Game Scenario\n\n"
156
+ # f"**Environment:** {st.session_state.env_description}\n\n"
157
+ # f"**Protagonist:** {st.session_state.protagonist_description}\n\n"
158
+ # f"**Antagonist:** {st.session_state.antagonist_description}\n\n"
159
+ # f"**Story:** {st.session_state.game_story}")
160
+ # else:
161
+ # combined_content = "Your complete game scenario and script will be generated based on the inputs provided."
162
 
163
+ # st.header("๐Ÿ“œ Game Scenario & Script")
164
+ # st.write(combined_content)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  import os
168
  import streamlit as st
169
  import anthropic
 
303
  st.header("๐Ÿฆธโ€โ™‚๏ธ Protagonist")
304
  if 'protagonist_description' in st.session_state:
305
  st.write(st.session_state.protagonist_description)
306
+ if st.button("Edit Protagonist Details", key="edit_protagonist"):
307
+ new_protagonist_description = st.text_area("Edit Protagonist Description", st.session_state.protagonist_description)
308
+ if st.button("Update Protagonist", key="update_protagonist"):
309
+ st.session_state.protagonist_description = generate_protagonist(new_protagonist_description)
310
+ st.experimental_rerun()
311
  else:
312
  st.write(protagonist)
313
  st.markdown("---")
 
316
  st.header("๐Ÿฆนโ€โ™€๏ธ Antagonist")
317
  if 'antagonist_description' in st.session_state:
318
  st.write(st.session_state.antagonist_description)
319
+ if st.button("Edit Antagonist Details", key="edit_antagonist"):
320
+ new_antagonist_description = st.text_area("Edit Antagonist Description", st.session_state.antagonist_description)
321
+ if st.button("Update Antagonist", key="update_antagonist"):
322
+ st.session_state.antagonist_description = generate_antagonist(new_antagonist_description)
323
+ st.experimental_rerun()
324
  else:
325
  st.write(antagonist)
326
  st.markdown("---")