tjain2603's picture
Update app.py
ecc18cc verified
raw
history blame contribute delete
No virus
705 Bytes
from langchain_community.llms import OpenAI
from dotenv import load_dotenv
import openai
import os
#openai.api_key = os.getenv("OPENAI_API_KEY")
import streamlit as st
## function to load OpenAI model and get response
def get_openai_response(question):
llm = OpenAI(model_name = "gpt-3.5-turbo-instruct")
response = llm(question)
return response
### Initialize stremlit app
st.set_page_config(page_title = "Q&A Demo")
st.header("Langchain Application")
input = st.text_input("Input: ", key = "input")
response = get_openai_response(input)
submit = st.button("Lets begin")
# If asked button is clicked
if submit:
st.subheader("The response is")
st.write(response)