File size: 523 Bytes
26746ae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from langchain_community.llms import OpenAI
from dotenv import load_dotenv
import os
load_dotenv()
import streamlit as st
def get_openai_response(question):
    llm=OpenAI(openai_api_key=os.getenv("OPENAI_API_KEY"),temperature=0.5)
    response=llm(question)
    return response
st.set_page_config(page_title="Chatbot demo")
st.header("Langchain Demo")
inp=st.text_input("Input: ",key="inp")
submit=st.button("Generate")
response=get_openai_response(inp)
if submit:
    st.subheader("Response is :")
    st.write(response)