Spaces:
Sleeping
Sleeping
File size: 859 Bytes
667be7b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# # QandA chatbot
# from langchain.llms import OpenAI
from langchain.chains import LLMChain
from langchain_community.llms import OpenAI
#from dotenv import load_dotenv
import os
# load_dotenv()
import streamlit as st
## Function to lod OpenAI model and get responses
def get_openai_response(question): ## not os.environ["OPEN_API_KEY"] use openai_api_key=os.getenv("OPEN_API_KEY")
llm = OpenAI(openai_api_key=os.getenv("OPEN_API_KEY"),temperature=0.6)
response = llm(question)
return response
st.set_page_config(page_title="QandA Chatbot", page_icon=":robot:")
st.header("Langchain Application")
input = st.text_input("Enter your question here: ",key="input")
response = get_openai_response(input)
submit = st.button("Submit/Generate")
## If ask button is clicked
if submit:
st.header("The response is:")
st.write(response)
|