kiran475h commited on
Commit
de67938
1 Parent(s): fca4974

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -33
app.py CHANGED
@@ -1,34 +1,34 @@
1
- # Q&A Chatbot
2
- from langchain.llms import OpenAI
3
-
4
- from dotenv import load_dotenv
5
-
6
- load_dotenv() # takes the enveronment vareable from .env
7
-
8
- import streamlit as st
9
- import os
10
-
11
- ## function to lad the openai model and to get the response
12
-
13
- os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
14
-
15
-
16
- def get_openai_response(question):
17
- llm = OpenAI(model_name="gpt-3.5-turbo-0125",temperature =0.6)
18
- response = llm(question)
19
- return response
20
- #initialize out streamlit app
21
- st.set_page_config(page_title='Q&A Demo')
22
-
23
- st.header("langchain application")
24
-
25
- input=st.text_input("Input: ", key = "input")
26
- response=get_openai_response(input)
27
-
28
-
29
- submit=st.button("generate")
30
-
31
-
32
- if submit:
33
- st.subheader("The response is ")
34
  st.write(response)
 
1
+ # Q&A Chatbot
2
+ from langchain.llms import OpenAI
3
+
4
+ from dotenv import load_dotenv
5
+
6
+ load_dotenv() # takes the enveronment vareable from .env
7
+
8
+ import streamlit as st
9
+ import os
10
+
11
+ ## function to lad the openai model and to get the response
12
+
13
+ os.environ["OPENAI_API_KEY"] = st.secrets("OPENAI_API_KEY")
14
+
15
+
16
+ def get_openai_response(question):
17
+ llm = OpenAI(model_name="gpt-3.5-turbo-0125",temperature =0.6)
18
+ response = llm(question)
19
+ return response
20
+ #initialize out streamlit app
21
+ st.set_page_config(page_title='Q&A Demo')
22
+
23
+ st.header("langchain application")
24
+
25
+ input=st.text_input("Input: ", key = "input")
26
+ response=get_openai_response(input)
27
+
28
+
29
+ submit=st.button("generate")
30
+
31
+
32
+ if submit:
33
+ st.subheader("The response is ")
34
  st.write(response)