Spaces:
Sleeping
Sleeping
File size: 806 Bytes
b197a8c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# 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
|