File size: 512 Bytes
142097b
 
1d0de55
 
 
 
 
 
142097b
 
9bb7a15
1d0de55
 
 
 
 
 
 
327a623
1d0de55
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import streamlit as st

from langchain.llms import OpenAI

def get_answer_from_open_ai(question: str)-> str:
    llm = OpenAI(model_name='text-davinci-003', temperature=0)
    return llm(question)

#App UI starts here
st.set_page_config(page_title="QnA app with LangChain and OpenAI", page_icon=":robot:")
st.header("Question and Answering App")


question = st.text_input('You: ', key='input')
response = get_answer_from_open_ai(question)

submit = st.button('Get the Answer')

if submit:
    st.write(response)