File size: 851 Bytes
cec2a68
f9ea26b
 
 
 
 
cec2a68
 
f9ea26b
 
 
 
 
 
 
cec2a68
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
from transformers import AutoModel
import torch

# Load the model
model = AutoModel.from_pretrained("huggingface/autoformer-tourism-monthly")

def forecast(month: str):
    # Simulated input tensor — replace with real preprocessing if available
    dummy_input = torch.rand(1, 36, 1)  # e.g. 36 months of past data
    output = model(dummy_input)

    # Simulate response (actual model output may vary depending on structure)
    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()