Spaces:
Sleeping
Sleeping
# components/characters.py | |
import gradio as gr | |
from image_utils import generate_character_image | |
from datetime import datetime | |
import json | |
import os | |
def save_to_gallery(content_type: str, data: dict, image_path: str): | |
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") | |
os.makedirs("gallery", exist_ok=True) | |
filename = f"gallery/{content_type}_{timestamp}.json" | |
with open(filename, "w") as f: | |
json.dump({"type": content_type, "data": data, "image": image_path}, f, indent=2) | |
def character_tab(): | |
with gr.TabItem("π Character Creator"): | |
with gr.Row(): | |
with gr.Column(): | |
name = gr.Textbox(label="Name", placeholder="Arannis Silverleaf") | |
race = gr.Dropdown(label="Race", choices=["Human", "Elf", "Dwarf", "Halfling", "Tiefl | |