Spaces:
Runtime error
Runtime error
Download app.py from manu-codes/dateparser: direct link, hf CLI and curl.
- Browser
- Download file 741 Bytes
-
https://huggingface.co/spaces/manu-codes/dateparser/resolve/main/app.py
- Command line
-
hf download hf://spaces/manu-codes/dateparser/app.py
-
curl -L -o app.py https://huggingface.co/spaces/manu-codes/dateparser/resolve/main/app.py
741 Bytes
| 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() |