astroarya commited on
Commit
3ee827b
·
verified ·
1 Parent(s): fe787ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -5,9 +5,12 @@ from langchain.prompts import PromptTemplate
5
  from langchain.chains import LLMChain, SequentialChain
6
  from langchain.memory import ConversationBufferMemory
7
  from langchain.utilities import WikipediaAPIWrapper
 
8
 
9
- OPENAI_KEY = os.getenv("OPENAI_API_KEY")
10
- os.environ['OPENAI_API_KEY'] = OPENAI_KEY
 
 
11
 
12
 
13
  # app framework
@@ -34,7 +37,7 @@ script_chain=LLMChain(llm=llm,prompt=script_template,verbose=True,output_key='sc
34
 
35
  wiki=WikipediaAPIWrapper()
36
 
37
- # Show stuff to teh screen if there is a prompt
38
  if prompt:
39
  title=title_chain.run(prompt)
40
  wiki_research=wiki.run(prompt)
 
5
  from langchain.chains import LLMChain, SequentialChain
6
  from langchain.memory import ConversationBufferMemory
7
  from langchain.utilities import WikipediaAPIWrapper
8
+ from transformers import GPT2LMHeadModel, GPT2Tokenizer
9
 
10
+ # Load the GPT-2 model and tokenizer
11
+ model_name = "gpt2"
12
+ tokenizer = GPT2Tokenizer.from_pretrained(model_name)
13
+ OpenAI = GPT2LMHeadModel.from_pretrained(model_name)
14
 
15
 
16
  # app framework
 
37
 
38
  wiki=WikipediaAPIWrapper()
39
 
40
+ # Show stuff to the screen if there is a prompt
41
  if prompt:
42
  title=title_chain.run(prompt)
43
  wiki_research=wiki.run(prompt)