Spaces:
Runtime error
Runtime error
import os | |
from constants import openai_key | |
from langchain_openai import OpenAI | |
import streamlit as st | |
from langchain import PromptTemplate | |
from langchain.chains import LLMChain | |
from langchain.chains import SimpleSequentialChain | |
#openai_key="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" | |
os.environ["OPENAI_API_KEY"]=openai_key | |
st.title('Award for a reason...') | |
input_text=st.text_input("Search the person you want it will show all awards he/she has ever got") | |
first_input_prompt=PromptTemplate( | |
input_variables=['name'], | |
template="Tell me about celebrity {name}" | |
) | |
llms=OpenAI(temperature=0.8) | |
chain=LLMChain(llm=llms,prompt=first_input_prompt,verbose=True,output_key='person') | |
second_input_prompt=PromptTemplate( | |
input_variables=['person'], | |
template="All Awards list {person} he has ever got " | |
template ="Don't provide any other information apart from the awards list" | |
) | |
chain2=LLMChain(llm=llms,prompt=second_input_prompt,verbose=True,output_key='dob') | |
parent_chain=SimpleSequentialChain(chains=[chain2],verbose=True) | |
# if input_text: | |
# st.write(llms(input_text)) | |
# if input_text: | |
# st.write(chain.run(input_text)) | |
if input_text: | |
st.write(parent_chain.run(input_text)) |