This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # generate text using different LLM models | |
| from langchain import PromptTemplate, LLMChain | |
| from langchain import HuggingFaceHub | |
| import os | |
| import pandas as pd | |
| from langchain.vectorstores import Chroma | |
| from langchain.chains.question_answering import load_qa_chain | |
| import requests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # generate text using different LLM models | |
| from langchain import PromptTemplate, LLMChain | |
| from langchain import HuggingFaceHub | |
| import os | |
| import pandas as pd | |
| os.environ["HUGGINGFACEHUB_API_TOKEN"] = "ENTER YOUR KEY from huggingface" | |
| repo_id = "tiiuae/falcon-7b-instruct" # See https://huggingface.co/models?pipeline_tag=text-generation&sort=downloads for some other options |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from PIL import Image | |
| # Open the PDF file | |
| with open("file.pdf", "rb") as f: | |
| pdf = Image.open(f) | |
| # Iterate over all pages | |
| for i in range(0, pdf.get_page_count()): | |
| # Set the current page | |
| pdf.seek(i) |