Spaces:
Running
on
Zero
Running
on
Zero
kwabs22
commited on
Commit
·
8b6d6cd
1
Parent(s):
ed49cfb
editing placeholder debug
Browse files
app.py
CHANGED
@@ -160,98 +160,6 @@ def show_elements(text):
|
|
160 |
return outputs
|
161 |
|
162 |
def show_elements_json_input(json_input):
|
163 |
-
# # Parse the JSON input
|
164 |
-
# data = json.loads(json_input)
|
165 |
-
|
166 |
-
# outputs = []
|
167 |
-
|
168 |
-
# # Iterate through all locations in the masterlocation1
|
169 |
-
# for location, details in data['masterlocation1'].items():
|
170 |
-
# if location == 'end':
|
171 |
-
# continue
|
172 |
-
|
173 |
-
# description = details['description']
|
174 |
-
|
175 |
-
# # Split the description, defaulting to 'Unknown' if no colon is present
|
176 |
-
# parts = description.split(': ', 1)
|
177 |
-
# if len(parts) == 2:
|
178 |
-
# block_type, content = parts
|
179 |
-
# else:
|
180 |
-
# block_type = 'Unknown'
|
181 |
-
# content = description
|
182 |
-
|
183 |
-
# if block_type == 'UI':
|
184 |
-
# # Create HTML for UI elements
|
185 |
-
# ui_html = f'<div class="ui-element">{content}</div>'
|
186 |
-
# outputs.append(gr.HTML(ui_html))
|
187 |
-
# elif block_type == 'Story':
|
188 |
-
# # Display story elements as Markdown
|
189 |
-
# outputs.append(gr.Markdown(f"**{content}**"))
|
190 |
-
# elif block_type == 'Media':
|
191 |
-
# content_lower = content.lower()
|
192 |
-
# if 'audio' in content_lower:
|
193 |
-
# # Placeholder for audio element
|
194 |
-
# outputs.append(gr.Audio(label=f"Audio: {content}"))
|
195 |
-
# elif 'video' in content_lower:
|
196 |
-
# # Placeholder for video element
|
197 |
-
# outputs.append(gr.Video(label=f"Video: {content}"))
|
198 |
-
# elif 'image' in content_lower:
|
199 |
-
# # Placeholder for image element
|
200 |
-
# outputs.append(gr.Image(label=f"Image: {content}"))
|
201 |
-
# else:
|
202 |
-
# # Default to text for unknown media types
|
203 |
-
# outputs.append(gr.Markdown(f"*Media: {content}*"))
|
204 |
-
# else:
|
205 |
-
# # Handle unknown types as plain text
|
206 |
-
# outputs.append(gr.Markdown(content))
|
207 |
-
|
208 |
-
# return outputs
|
209 |
-
|
210 |
-
#================================================================================================
|
211 |
-
# data = json.loads(json_input)
|
212 |
-
# masterlocation1 = data['masterlocation1']
|
213 |
-
|
214 |
-
# outputs = []
|
215 |
-
|
216 |
-
# for location, details in masterlocation1.items():
|
217 |
-
# if location == 'end':
|
218 |
-
# continue
|
219 |
-
|
220 |
-
# with gr.Accordion(f"Location: {location}"):
|
221 |
-
# description = gr.Textbox(label="Description", value=details['description'])
|
222 |
-
# outputs.append(description)
|
223 |
-
|
224 |
-
# events = gr.JSON(label="Events", value=details['events'])
|
225 |
-
# outputs.append(events)
|
226 |
-
|
227 |
-
# choices = gr.JSON(label="Choices", value=details['choices'])
|
228 |
-
# outputs.append(choices)
|
229 |
-
|
230 |
-
# transitions = gr.JSON(label="Transitions", value=details['transitions'])
|
231 |
-
# outputs.append(transitions)
|
232 |
-
|
233 |
-
# def update_json():
|
234 |
-
# updated_data = {"masterlocation1": {}}
|
235 |
-
# for i, location in enumerate(masterlocation1.keys()):
|
236 |
-
# if location == 'end':
|
237 |
-
# continue
|
238 |
-
# updated_data["masterlocation1"][location] = {
|
239 |
-
# "description": outputs[i*4].value,
|
240 |
-
# "events": outputs[i*4 + 1].value,
|
241 |
-
# "choices": outputs[i*4 + 2].value,
|
242 |
-
# "transitions": outputs[i*4 + 3].value
|
243 |
-
# }
|
244 |
-
# updated_data["masterlocation1"]["end"] = masterlocation1["end"]
|
245 |
-
# return json.dumps(updated_data, indent=2)
|
246 |
-
|
247 |
-
# update_button = gr.Button("Update JSON")
|
248 |
-
# json_output = gr.JSON(label="Updated JSON")
|
249 |
-
|
250 |
-
# update_button.click(update_json, outputs=json_output)
|
251 |
-
|
252 |
-
# return outputs + [update_button, json_output]
|
253 |
-
|
254 |
-
#================================================================================================
|
255 |
data = json.loads(json_input)
|
256 |
masterlocation1 = data['masterlocation1']
|
257 |
|
@@ -629,7 +537,9 @@ with gr.Blocks() as demo:
|
|
629 |
generate_no_ui_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of ui timeline points")
|
630 |
generate_no_media_timeline_points = gr.Slider(minimum=1, value=5, step=1, maximum=30, label="Choose the amount of media timeline points")
|
631 |
generate_with_media_check = gr.Checkbox(label="Generate with media", value=True)
|
632 |
-
generate_button = gr.Button("Generate Story and Timeline")
|
|
|
|
|
633 |
@gr.render(inputs=game_structure_output_text_with_media)
|
634 |
def update(game_structure_output_text_with_media):
|
635 |
return show_elements_json_input(game_structure_output_text_with_media)
|
@@ -643,6 +553,7 @@ with gr.Blocks() as demo:
|
|
643 |
@gr.render(inputs=input_text)
|
644 |
def update(text):
|
645 |
return show_elements(text)
|
|
|
646 |
with gr.Tab("Asset First"):
|
647 |
gr.HTML("Make Asset and make the transitions using LLM")
|
648 |
|
|
|
160 |
return outputs
|
161 |
|
162 |
def show_elements_json_input(json_input):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
163 |
data = json.loads(json_input)
|
164 |
masterlocation1 = data['masterlocation1']
|
165 |
|
|
|
537 |
generate_no_ui_timeline_points = gr.Slider(minimum=1, value=10, step=1, maximum=30, label="Choose the amount of ui timeline points")
|
538 |
generate_no_media_timeline_points = gr.Slider(minimum=1, value=5, step=1, maximum=30, label="Choose the amount of media timeline points")
|
539 |
generate_with_media_check = gr.Checkbox(label="Generate with media", value=True)
|
540 |
+
generate_button = gr.Button("Generate Story and Timeline")
|
541 |
+
gr.HTML("Still under construction - The update json below doesnt work for so dont edit here yet")
|
542 |
+
|
543 |
@gr.render(inputs=game_structure_output_text_with_media)
|
544 |
def update(game_structure_output_text_with_media):
|
545 |
return show_elements_json_input(game_structure_output_text_with_media)
|
|
|
553 |
@gr.render(inputs=input_text)
|
554 |
def update(text):
|
555 |
return show_elements(text)
|
556 |
+
|
557 |
with gr.Tab("Asset First"):
|
558 |
gr.HTML("Make Asset and make the transitions using LLM")
|
559 |
|