Spaces:
Running
Running
File size: 682 Bytes
176bc9a b5553ae 176bc9a b5553ae 176bc9a b5553ae |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
from transformers import AutoTokenizer, AutoModel, pipeline
from huggingface_hub import hf_hub_download
def load_model():
tokenizer = AutoTokenizer.from_pretrained("sentence-transformers/all-MiniLM-L6-v2")
model = AutoModel.from_pretrained("sentence-transformers/all-MiniLM-L6-v2", device_map="cpu")
return tokenizer, model
def load_generator():
return pipeline('text2text-generation', model='google/flan-t5-base', device_map="cpu")
def download_pdf():
# Replace 'your_pdf_file.pdf' with the actual name of your PDF file on Hugging Face
file_path = hf_hub_download(repo_id="your_username/your_repo_name", filename="your_pdf_file.pdf")
return file_path |