Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from batch import run | |
| def predict_duration(year, month): | |
| try: | |
| year = int(year) | |
| month = int(month) | |
| output_file, mean_duration = run(year, month) | |
| return f" Done! Output saved to: {output_file}\n Mean predicted duration: {mean_duration:.2f} minutes" | |
| except Exception as e: | |
| return f" Error: {str(e)}" | |
| iface = gr.Interface( | |
| fn=predict_duration, | |
| inputs=[ | |
| gr.Textbox(label="Year (e.g. 2023)"), | |
| gr.Textbox(label="Month (e.g. 4 for April)") | |
| ], | |
| outputs="text", | |
| title="NYC Taxi Duration Predictor", | |
| description="Enter a year and month to predict ride durations using a trained ML model." | |
| ) | |
| if __name__ == "__main__": | |
| iface.launch() | |