davidr99 commited on
Commit
bd40713
·
1 Parent(s): 60c47b7

Update gpu

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -1,14 +1,17 @@
1
  from PIL import Image
2
  from unsloth import FastVisionModel
3
- model, tokenizer = FastVisionModel.from_pretrained(
4
- model_name = "davidr99/qwen2-7b-instruct-blackjack", # YOUR MODEL YOU USED FOR TRAINING
5
- load_in_4bit = True, # Set to False for 16bit LoRA
6
- )
7
- FastVisionModel.for_inference(model) # Enable for inference!
8
 
9
  import gradio as gr
10
 
 
11
  def blackjack_ai(image):
 
 
 
 
 
 
12
  image = Image.fromarray(image.astype('uint8'), 'RGB')
13
  instruction = "Write the LaTeX representation for this image."
14
 
 
1
  from PIL import Image
2
  from unsloth import FastVisionModel
3
+ import spaces
 
 
 
 
4
 
5
  import gradio as gr
6
 
7
+ @spaces.GPU(duration=30)
8
  def blackjack_ai(image):
9
+ model, tokenizer = FastVisionModel.from_pretrained(
10
+ model_name = "davidr99/qwen2-7b-instruct-blackjack", # YOUR MODEL YOU USED FOR TRAINING
11
+ load_in_4bit = True, # Set to False for 16bit LoRA
12
+ )
13
+ FastVisionModel.for_inference(model) # Enable for inference!
14
+
15
  image = Image.fromarray(image.astype('uint8'), 'RGB')
16
  instruction = "Write the LaTeX representation for this image."
17