import gradio as gr from gradio.themes.base import Base from gradio.themes.utils import colors, fonts, sizes class TufteInspired(Base): def __init__( self, *, primary_hue: colors.Color | str = colors.stone, secondary_hue: colors.Color | str = colors.gray, neutral_hue: colors.Color | str = colors.gray, spacing_size: sizes.Size | str = sizes.spacing_md, radius_size: sizes.Size | str = sizes.radius_sm, text_size: sizes.Size | str = sizes.text_lg, font: list[fonts.Font | str] = [ fonts.GoogleFont("EB Garamond"), "Georgia", "serif" ], font_mono: list[fonts.Font | str] = [ fonts.GoogleFont("IBM Plex Mono"), "Consolas", "monospace" ], ): super().__init__( primary_hue=primary_hue, secondary_hue=secondary_hue, neutral_hue=neutral_hue, spacing_size=spacing_size, radius_size=radius_size, text_size=text_size, font=font, font_mono=font_mono, ) self.set( body_background_fill="#fffff8", body_background_fill_dark="#151515", body_text_color="*neutral_950", body_text_color_dark="*neutral_50", background_fill_primary="#fffff8", background_fill_primary_dark="#151515", block_title_text_weight="400", block_border_width="0px", block_shadow="none", button_primary_background_fill="*primary_100", button_primary_background_fill_hover="*primary_200", button_primary_text_color="*neutral_950", button_primary_border_color="*primary_300", button_shadow="none", input_background_fill="*secondary_50", input_background_fill_dark="*secondary_900", input_border_color="*secondary_200", input_border_color_dark="*secondary_700", input_shadow="none", ) import gradio as gr import json from datetime import datetime # Placeholder LLM function def generate_blurb(): # This is where you'd call your LLM model return "A thrilling journey through time and space, where heroes rise and fall, and the fate of the universe hangs in the balance." # Function to log blurb and vote def log_blurb_and_vote(blurb, vote): log_entry = { "timestamp": datetime.now().isoformat(), "blurb": blurb, "vote": vote } with open("blurb_log.jsonl", "a") as f: f.write(json.dumps(log_entry) + "\n") return f"Logged: {vote}" # Create custom theme tufte_theme = TufteInspired() # Create Gradio interface with gr.Blocks(theme=tufte_theme) as demo: gr.Markdown("