Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -16,11 +16,12 @@ import easyocr
|
|
16 |
# Initialize FastAPI
|
17 |
app = FastAPI()
|
18 |
|
19 |
-
|
20 |
model_name = "mistralai/Mistral-7B-Instruct"
|
21 |
-
|
22 |
-
|
23 |
-
|
|
|
24 |
|
25 |
doc_qa_pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer, device=-1)
|
26 |
|
|
|
16 |
# Initialize FastAPI
|
17 |
app = FastAPI()
|
18 |
|
19 |
+
print(f"π Loading models")
|
20 |
model_name = "mistralai/Mistral-7B-Instruct"
|
21 |
+
hf_token = os.getenv("HUGGINGFACEHUB_API_TOKEN") # Fetch token from environment variable
|
22 |
+
|
23 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, token=hf_token)
|
24 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, token=hf_token)
|
25 |
|
26 |
doc_qa_pipeline = pipeline("text-generation", model=model, tokenizer=tokenizer, device=-1)
|
27 |
|