akhaliq HF Staff commited on
Commit
3f5e597
·
verified ·
1 Parent(s): 54692e0

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -1,17 +1,17 @@
1
  import gradio as gr
2
  import torch
3
  from transformers import AutoModelForCausalLM, AutoTokenizer
4
- from zerogpu import setup_zerogpu
5
 
6
  # Load model and tokenizer
7
  model_id = "LiquidAI/LFM2-2.6B"
8
- setup_zerogpu()
9
  model = AutoModelForCausalLM.from_pretrained(
10
  model_id,
11
  device_map="auto", # Ensure proper device mapping for zero-gpu
12
  )
13
  tokenizer = AutoTokenizer.from_pretrained(model_id)
14
 
 
15
  def chat_with_model(message, history):
16
  # Format conversation history
17
  conversation = []
 
1
  import gradio as gr
2
  import torch
3
  from transformers import AutoModelForCausalLM, AutoTokenizer
4
+ import spaces
5
 
6
  # Load model and tokenizer
7
  model_id = "LiquidAI/LFM2-2.6B"
 
8
  model = AutoModelForCausalLM.from_pretrained(
9
  model_id,
10
  device_map="auto", # Ensure proper device mapping for zero-gpu
11
  )
12
  tokenizer = AutoTokenizer.from_pretrained(model_id)
13
 
14
+ @spaces.GPU(duration=120)
15
  def chat_with_model(message, history):
16
  # Format conversation history
17
  conversation = []