Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import fitz # PyMuPDF
|
| 3 |
-
from transformers import
|
| 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 |
-
|
|
|
|
| 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)
|