Spaces:
Sleeping
Sleeping
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() | |