Update app.py
Browse files
app.py
CHANGED
@@ -81,19 +81,19 @@ st.image(image, caption='Your target document')
|
|
81 |
|
82 |
with st.spinner(f'Processing the document ...'):
|
83 |
pre_trained_model = "unstructuredio/chipper-fast-fine-tuning"
|
84 |
-
processor = DonutProcessor.from_pretrained(pre_trained_model)
|
85 |
|
86 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
87 |
|
88 |
if 'model' in st.session_state:
|
89 |
model = st.session_state['model']
|
90 |
else:
|
91 |
-
model = VisionEncoderDecoderModel.from_pretrained(pre_trained_model)
|
92 |
|
93 |
from huggingface_hub import hf_hub_download
|
94 |
|
95 |
lm_head_file = hf_hub_download(
|
96 |
-
repo_id=pre_trained_model, filename="lm_head.pth"
|
97 |
)
|
98 |
|
99 |
rank = 128
|
|
|
81 |
|
82 |
with st.spinner(f'Processing the document ...'):
|
83 |
pre_trained_model = "unstructuredio/chipper-fast-fine-tuning"
|
84 |
+
processor = DonutProcessor.from_pretrained(pre_trained_model, use_auth_token=os.environ['HF_TOKEN'])
|
85 |
|
86 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
87 |
|
88 |
if 'model' in st.session_state:
|
89 |
model = st.session_state['model']
|
90 |
else:
|
91 |
+
model = VisionEncoderDecoderModel.from_pretrained(pre_trained_model, use_auth_token=os.environ['HF_TOKEN'])
|
92 |
|
93 |
from huggingface_hub import hf_hub_download
|
94 |
|
95 |
lm_head_file = hf_hub_download(
|
96 |
+
repo_id=pre_trained_model, filename="lm_head.pth", token=os.environ['HF_TOKEN']
|
97 |
)
|
98 |
|
99 |
rank = 128
|