avinashp1's picture
Upload app.py
fec8f6c
raw
history blame contribute delete
537 Bytes
from langchain.llms import OpenAI
import streamlit as st
import os
from dotenv import load_dotenv
load_dotenv()
def get_openai_response(question):
llm=OpenAI(openai_api_key=os.getenv("OPENAI_API_KEY"),model_name="text-davinci-003",temperature=0.5)
response=llm(question)
return response
st.set_page_config("ChatBot")
st.header("Langchain App")
input=st.text_input("Input:",key="input")
response=get_openai_response(input)
submit=st.button('Answer')
if submit:
st.subheader("The Response is")
st.write(response)