Spaces:
Sleeping
Sleeping
File size: 2,234 Bytes
b197a8c |
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 50 51 52 53 54 55 56 57 |
# components/scenarios.py
:contentReference[oaicite:1]{index=1}
:contentReference[oaicite:2]{index=2}
:contentReference[oaicite:3]{index=3}
import json
import os
:contentReference[oaicite:4]{index=4}
:contentReference[oaicite:5]{index=5}
:contentReference[oaicite:6]{index=6}
:contentReference[oaicite:7]{index=7}
:contentReference[oaicite:8]{index=8}
:contentReference[oaicite:9]{index=9}
def scenario_tab():
:contentReference[oaicite:10]{index=10}
:contentReference[oaicite:11]{index=11}
:contentReference[oaicite:12]{index=12}
:contentReference[oaicite:13]{index=13}
:contentReference[oaicite:14]{index=14}
:contentReference[oaicite:15]{index=15}
value="Exploration")
:contentReference[oaicite:16]{index=16}
:contentReference[oaicite:17]{index=17}
:contentReference[oaicite:18]{index=18}
:contentReference[oaicite:19]{index=19}
:contentReference[oaicite:20]{index=20}
export_button = gr.Button("๐พ Save Scenario to Gallery")
export_status = gr.Textbox(label="Export Status")
def build_and_generate(title, scenario_type, difficulty, duration, setting):
data = {
"title": title,
"scenario_type": scenario_type,
"difficulty_level": difficulty,
"duration": duration,
"setting": setting
}
return generate_scenario_image(data, art_style="Concept Art")
gen_button.click(
build_and_generate,
inputs=[title, scenario_type, difficulty, duration, setting],
outputs=scenario_img
)
export_button.click(
lambda t, st, d, du, se, img: save_to_gallery(
"scenario",
{"title": t, "type": st, "difficulty": d, "duration": du, "setting": se},
img
) or "โ
Scenario saved!",
inputs=[title, scenario_type, difficulty, duration, setting, scenario_img],
outputs=export_status
)
|