RapidOrc121 commited on
Commit
26746ae
1 Parent(s): 40fb046

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain_community.llms import OpenAI
2
+ from dotenv import load_dotenv
3
+ import os
4
+ load_dotenv()
5
+ import streamlit as st
6
+ def get_openai_response(question):
7
+ llm=OpenAI(openai_api_key=os.getenv("OPENAI_API_KEY"),temperature=0.5)
8
+ response=llm(question)
9
+ return response
10
+ st.set_page_config(page_title="Chatbot demo")
11
+ st.header("Langchain Demo")
12
+ inp=st.text_input("Input: ",key="inp")
13
+ submit=st.button("Generate")
14
+ response=get_openai_response(inp)
15
+ if submit:
16
+ st.subheader("Response is :")
17
+ st.write(response)