xzuyn commited on
Commit
24bde1f
·
verified ·
1 Parent(s): 3463c28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -5,13 +5,13 @@ import numpy as np
5
  from PIL import Image
6
  import gradio as gr
7
  import torch
8
- from transformers import AutoProcessor, AutoModelForCausalLM
9
 
10
 
11
  # Load model and processor, enabling trust_remote_code if needed
12
  model_name = "PJMixers-Images/Florence-2-base-Castollux-v0.5-JPEG-Quality-Detection-v0.1"
13
- model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True).eval()
14
- processor = AutoProcessor.from_pretrained(model_name, trust_remote_code=True)
15
 
16
  # Set device (GPU if available)
17
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
 
5
  from PIL import Image
6
  import gradio as gr
7
  import torch
8
+ from transformers import AutoProcessor, Florence2ForConditionalGeneration
9
 
10
 
11
  # Load model and processor, enabling trust_remote_code if needed
12
  model_name = "PJMixers-Images/Florence-2-base-Castollux-v0.5-JPEG-Quality-Detection-v0.1"
13
+ model = Florence2ForConditionalGeneration.from_pretrained(model_name).eval()
14
+ processor = AutoProcessor.from_pretrained(model_name)
15
 
16
  # Set device (GPU if available)
17
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")