from langchain.llms import OpenAI from dotenv import load_dotenv import streamlit as st import os load_dotenv() def get_openai_response(request): llm = OpenAI(openai_api_key = os.getenv("OPENAI_API_KEY") , temperature=0.6) return llm.predict(request) st.set_page_config(page_title="Q&A Demo") st.header("Langchain Application") input = st.text_input("Input: ", key = "input") submit = st.button("Generate") if submit: response = get_openai_response(input) st.subheader("The response is : ") st.write(response)