Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -5,9 +5,20 @@ import re
|
|
5 |
from PIL import Image
|
6 |
import spaces # Add spaces import for Hugging Face Spaces
|
7 |
import os
|
|
|
8 |
|
9 |
hf_token = os.getenv("API_KEY")
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
# Model information
|
12 |
MODEL_ID = "DeepMount00/SmolVLM-Base-ocr_base"
|
13 |
OCR_INSTRUCTION = "Sei un assistente esperto di OCR, converti il testo in formato MD."
|
|
|
5 |
from PIL import Image
|
6 |
import spaces # Add spaces import for Hugging Face Spaces
|
7 |
import os
|
8 |
+
import sys
|
9 |
|
10 |
hf_token = os.getenv("API_KEY")
|
11 |
|
12 |
+
# Set the Hugging Face logging to error only to avoid sensitive info in logs
|
13 |
+
logging.set_verbosity_error()
|
14 |
+
|
15 |
+
# If the key is found, use it to authenticate
|
16 |
+
if hf_token:
|
17 |
+
HfFolder.save_token(hf_token) # This authenticates you for this session
|
18 |
+
else:
|
19 |
+
print("No HF_KEY found. Please make sure you've set up your Hugging Face API key as an environment variable.")
|
20 |
+
|
21 |
+
|
22 |
# Model information
|
23 |
MODEL_ID = "DeepMount00/SmolVLM-Base-ocr_base"
|
24 |
OCR_INSTRUCTION = "Sei un assistente esperto di OCR, converti il testo in formato MD."
|