File size: 657 Bytes
674bcce |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
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)
|