Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,18 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
def forecast(month: str):
|
| 4 |
-
#
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
gr.Interface(
|
| 8 |
fn=forecast,
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import AutoModel
|
| 3 |
+
import torch
|
| 4 |
+
|
| 5 |
+
# Load the model
|
| 6 |
+
model = AutoModel.from_pretrained("huggingface/autoformer-tourism-monthly")
|
| 7 |
|
| 8 |
def forecast(month: str):
|
| 9 |
+
# Simulated input tensor — replace with real preprocessing if available
|
| 10 |
+
dummy_input = torch.rand(1, 36, 1) # e.g. 36 months of past data
|
| 11 |
+
output = model(dummy_input)
|
| 12 |
+
|
| 13 |
+
# Simulate response (actual model output may vary depending on structure)
|
| 14 |
+
prediction = output.last_hidden_state.mean().item()
|
| 15 |
+
return f"Predicted tourism for {month}: {round(prediction * 1_000_000, 2)} visitors"
|
| 16 |
|
| 17 |
gr.Interface(
|
| 18 |
fn=forecast,
|