import gradio as gr from datetime import datetime, timedelta def generate_release_notes(github_url, github_token, gemini_api_key, start_date, end_date): # Parse the datetime strings start_date = datetime.fromisoformat(start_date).date() end_date = datetime.fromisoformat(end_date).date() # Your existing function implementation here # ... return f"Generated release notes for {github_url} from {start_date} to {end_date}" # Set default dates default_end_date = datetime.now() default_start_date = default_end_date - timedelta(days=7) # One week ago # Create Gradio interface iface = gr.Interface( fn=generate_release_notes, inputs=[ gr.Textbox(label="GitHub Repository URL (e.g., https://github.com/MicroHealthLLC/maiko-assistant.git)"), gr.Textbox(label="GitHub Personal Access Token", type="password"), gr.Textbox(label="Gemini API Key", type="password"), gr.DateTime( label="Start Date", value=default_start_date.date().isoformat(), type="datetime", include_time=False, interactive=True, visible=True ), gr.DateTime( label="End Date", value=default_end_date.date().isoformat(), type="datetime", include_time=False, interactive=True, visible=True ) ], outputs=gr.Textbox(label="Generated Release Notes"), title="Automated Release Notes Generator", description="Generate release notes based on GitHub commits using Gemini AI. Select start and end dates to define the time range for commits.", allow_flagging="never", theme="default", analytics_enabled=False ) # Launch the app iface.launch()