import gradio as gr import dateparser def parse_date_time(text): dt = dateparser.parse(text) if dt: return str(dt) else: return "Could not parse date and time." inputs = gr.inputs.Textbox(label="Enter a date and/or time in natural language.") outputs = gr.outputs.Textbox(label="Parsed date and time.") title = "Natural Language Date and Time Parser" description = "Enter a date and/or time in natural language (e.g. 'next Tuesday at 3pm') and the app will attempt to parse it into a machine-readable format." examples = [["tomorrow at 8am"], ["next week on Wednesday at noon"], ["in two hours"]] gr.Interface(parse_date_time, inputs, outputs, title=title, description=description, examples=examples).launch()