pratikshahp commited on
Commit
6f57d4d
·
verified ·
1 Parent(s): 3e147ae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -1,7 +1,6 @@
1
  import streamlit as st
2
  import fitz # PyMuPDF
3
- from transformers import pipeline
4
- from langchain_community.llms import HuggingFaceLLM
5
  from langchain.prompts import PromptTemplate
6
  from langchain.chains import LLMChain
7
 
@@ -25,7 +24,8 @@ def generate_mcqs(text, num_questions=5):
25
  prompt = prompt_template.format(text=text, num_questions=num_questions)
26
 
27
  # Load HuggingFace model
28
- llm = HuggingFaceLLM(model="openai/gpt-3.5-turbo")
 
29
 
30
  # Create an LLM chain with the prompt
31
  chain = LLMChain(prompt_template=PromptTemplate(template=prompt_template), llm=llm)
 
1
  import streamlit as st
2
  import fitz # PyMuPDF
3
+ from transformers import AutoTokenizer, AutoModelForCausalLM
 
4
  from langchain.prompts import PromptTemplate
5
  from langchain.chains import LLMChain
6
 
 
24
  prompt = prompt_template.format(text=text, num_questions=num_questions)
25
 
26
  # Load HuggingFace model
27
+ tokenizer = AutoTokenizer.from_pretrained("openai-community/gpt2-large")
28
+ llm = AutoModelForCausalLM.from_pretrained("openai-community/gpt2-large")
29
 
30
  # Create an LLM chain with the prompt
31
  chain = LLMChain(prompt_template=PromptTemplate(template=prompt_template), llm=llm)