|
|
import gradio as gr |
|
|
from transformers import AutoModel |
|
|
import torch |
|
|
|
|
|
|
|
|
model = AutoModel.from_pretrained("huggingface/autoformer-tourism-monthly") |
|
|
|
|
|
def forecast(month: str): |
|
|
|
|
|
dummy_input = torch.rand(1, 36, 1) |
|
|
output = model(dummy_input) |
|
|
|
|
|
|
|
|
prediction = output.last_hidden_state.mean().item() |
|
|
return f"Predicted tourism for {month}: {round(prediction * 1_000_000, 2)} visitors" |
|
|
|
|
|
gr.Interface( |
|
|
fn=forecast, |
|
|
inputs=gr.Textbox(label="Enter Month (e.g. Jan 2023)"), |
|
|
outputs=gr.Textbox(label="Tourism Forecast"), |
|
|
title="AI Tourism Predictor", |
|
|
description="Predict future tourism stats using Autoformer model." |
|
|
).launch() |
|
|
|