mynkchaudhry commited on
Commit
e25c164
1 Parent(s): cc9f8b9

upload all the files

Browse files
Files changed (1) hide show
  1. app.py +4 -18
app.py CHANGED
@@ -1,25 +1,11 @@
1
  import gradio as gr
2
- from transformers import AutoModelForCausalLM, AutoProcessor, AutoConfig
3
- import torch
4
  from PIL import Image
5
-
6
- # Custom configuration class
7
- class Florence2Config(AutoConfig):
8
- def to_dict(self):
9
- config_dict = super().to_dict()
10
- return config_dict
11
 
12
  # Load model and processor with trust_remote_code=True
13
- model = AutoModelForCausalLM.from_pretrained(
14
- "mynkchaudhry/Florence-2-FT-DocVQA",
15
- force_download=True,
16
- trust_remote_code=True
17
- )
18
- processor = AutoProcessor.from_pretrained(
19
- "mynkchaudhry/Florence-2-FT-DocVQA",
20
- force_download=True,
21
- trust_remote_code=True
22
- )
23
 
24
  def generate_response(image, question):
25
  try:
 
1
  import gradio as gr
2
+ from transformers import AutoModelForCausalLM, AutoProcessor
 
3
  from PIL import Image
4
+ import torch
 
 
 
 
 
5
 
6
  # Load model and processor with trust_remote_code=True
7
+ model = AutoModelForCausalLM.from_pretrained("mynkchaudhry/Florence-2-FT-DocVQA", force_download=True, trust_remote_code=True)
8
+ processor = AutoProcessor.from_pretrained("mynkchaudhry/Florence-2-FT-DocVQA", force_download=True, trust_remote_code=True)
 
 
 
 
 
 
 
 
9
 
10
  def generate_response(image, question):
11
  try: