RapidOrc121's picture
Upload app.py
26746ae verified
raw
history blame
523 Bytes
from langchain_community.llms import OpenAI
from dotenv import load_dotenv
import os
load_dotenv()
import streamlit as st
def get_openai_response(question):
llm=OpenAI(openai_api_key=os.getenv("OPENAI_API_KEY"),temperature=0.5)
response=llm(question)
return response
st.set_page_config(page_title="Chatbot demo")
st.header("Langchain Demo")
inp=st.text_input("Input: ",key="inp")
submit=st.button("Generate")
response=get_openai_response(inp)
if submit:
st.subheader("Response is :")
st.write(response)