qna / app.py
afiz's picture
Update app.py
9bb7a15
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)