Spaces:
Sleeping
Sleeping
# # 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) | |