Skip to content

Instantly share code, notes, and snippets.

View yadavmanoj354's full-sized avatar
🎯
Focusing

Manoj Yadav yadavmanoj354

🎯
Focusing
View GitHub Profile
@yadavmanoj354
yadavmanoj354 / description_image_products.py
Created June 26, 2023 15:27
A simple LLM Application that takes product name as input and generates a short description about the product and later scraps images related to same using web.
# 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
@yadavmanoj354
yadavmanoj354 / text_generation_llm.py
Created June 7, 2023 20:10
Langchain and Hugginface basic working for Description generation and question answering
# 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
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)