Spaces:
Build error
Build error
Update app.py
Browse files
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 |
-
|
| 10 |
-
|
|
|
|
|
|
|
| 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
|
| 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)
|