ganjipraveen444 commited on
Commit
f9ea26b
·
verified ·
1 Parent(s): 9cc118b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -1,8 +1,18 @@
1
  import gradio as gr
 
 
 
 
 
2
 
3
  def forecast(month: str):
4
- # Dummy output for now (we’ll replace with real model later)
5
- return f"Predicted tourism for {month}: 1.2M visitors"
 
 
 
 
 
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,