Spaces:
Runtime error
Runtime error
File size: 741 Bytes
ce7467a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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() |