sanjivinsmoke121's picture
Upload 2 files
674bcce verified
raw
history blame
657 Bytes
from langchain.llms import OpenAI
from dotenv import load_dotenv
import streamlit as st
import os
# Simple Chatbot
load_dotenv() # take environment
# Function to load openai model and get reponse
def get_response_ai(question):
llm = OpenAI(model_name = "gpt-3.5-turbo",temperature = 0.75)
response = llm(question)
return response
# initialize our streamlit app
st.set_page_config(page_title = 'Q&A Demo')
st.header('Langchain Application')
question = st.text_input("Input :",key = "input")
response = get_response_ai(question)
submit = st.button('Ask a question')
if submit:
st.subheader("The Response is ")
st.write(response)