JaniShubh's picture
Upload 3 files
aa93fe7
raw
history blame contribute delete
577 Bytes
from langchain.llms import OpenAI
import os
from dotenv import load_dotenv
load_dotenv()
import streamlit as st
def get_openAI_response(question):
llm=OpenAI(openai_api_key=os.getenv("OPEN_API_KEY"),model_name= "text-davinci-003",temperature = 0.5)
response = llm(question)
return response
st.set_page_config(page_title = "QnA demo")
st.header("langchain app")
input = st.text_input("Input : ",key="input")
response = get_openAI_response(input)
submit = st.button("ask the question")
if submit:
st.subheader("AI answer : ")
st.write(response)