EswarP commited on
Commit
efdbd4b
1 Parent(s): 79b487e

Upload chatbot.py

Browse files
Files changed (1) hide show
  1. chatbot.py +23 -0
chatbot.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain.llms import OpenAI
2
+ from dotenv import load_dotenv
3
+ import os
4
+
5
+ load_dotenv() #to load the enviroment variables
6
+
7
+ import streamlit as st
8
+
9
+ def get_opeanai_response(question):
10
+ llm=OpenAI(openai_api_key=os.environ['OPEN_API_KEY'],temperature=0.6)
11
+ response=llm(question)
12
+ return response
13
+
14
+ st.title('Q&A Chatbot')
15
+ input=st.text_input('Input: ',key=input)
16
+ submit=st.button('Ask the Question:')
17
+
18
+ if submit:
19
+ st.subheader('The response is: ')
20
+ st.write(get_opeanai_response(input))
21
+
22
+
23
+