mynkchaudhry commited on
Commit
beb129b
·
1 Parent(s): c6d3ca9

upload all the files

Browse files
Files changed (1) hide show
  1. app.py +7 -8
app.py CHANGED
@@ -1,19 +1,18 @@
1
  import os
 
 
 
 
2
 
3
  def prompt_user_acceptance():
4
- response = input("Do you accept the execution of remote code from the model repository? (y/N): ").strip().lower()
5
- if response != 'y':
6
- print("You must accept to continue.")
7
  exit(1)
8
 
9
  def main():
10
  prompt_user_acceptance()
11
 
12
- import gradio as gr
13
- from transformers import AutoModelForCausalLM, AutoProcessor
14
- from PIL import Image
15
- import torch
16
-
17
  # Load model and processor
18
  model = AutoModelForCausalLM.from_pretrained("mynkchaudhry/Florence-2-FT-DocVQA", force_download=True)
19
  processor = AutoProcessor.from_pretrained("mynkchaudhry/Florence-2-FT-DocVQA", force_download=True)
 
1
  import os
2
+ import gradio as gr
3
+ from transformers import AutoModelForCausalLM, AutoProcessor
4
+ from PIL import Image
5
+ import torch
6
 
7
  def prompt_user_acceptance():
8
+ # Check environment variable
9
+ if os.getenv('TRUST_REMOTE_CODE') != 'true':
10
+ print("You must accept to continue. Set the environment variable TRUST_REMOTE_CODE=true.")
11
  exit(1)
12
 
13
  def main():
14
  prompt_user_acceptance()
15
 
 
 
 
 
 
16
  # Load model and processor
17
  model = AutoModelForCausalLM.from_pretrained("mynkchaudhry/Florence-2-FT-DocVQA", force_download=True)
18
  processor = AutoProcessor.from_pretrained("mynkchaudhry/Florence-2-FT-DocVQA", force_download=True)