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