afiz commited on
Commit
1d0de55
·
1 Parent(s): 142097b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -1,5 +1,20 @@
1
  import streamlit as st
2
 
 
 
 
 
 
 
3
  #App UI starts here
4
  st.set_page_config(page_title="QnA app with LangChain and OpenAI", page_icon=":robot:")
5
- st.header("Question and Answering App")
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
 
3
+ from langchain.llms import OpenAI
4
+
5
+ def get_answer_from_open_ai(question: str)-> str:
6
+ llm = OpenAI(model_name='text-davinci-003', temperature=0)
7
+ return llm(question)
8
+
9
  #App UI starts here
10
  st.set_page_config(page_title="QnA app with LangChain and OpenAI", page_icon=":robot:")
11
+ st.header("Question and Answering App")
12
+
13
+
14
+ question = st.text_input('You: ', key='input')
15
+ response = get_answer_from_open_ai(question)
16
+
17
+ submit = st.button('Get the Answer')
18
+
19
+ if sumbit:
20
+ st.write(response)