CoolFace
Apppublic

saint324/QnAChatbot

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes
app.py29 linesDownload Raw Back to root
1# Q & A Chatbot demo2from langchain.llms import OpenAI3# from dotenv import load_dotenv4import streamlit as st5import os6# load_dotenv()7 8# Function to load OpenAI model and get response9 10def get_openai_response(question):11    llm = OpenAI(12        model_name= 'text-davinci-003',13        temperature=0.614    )15    response = llm(question)16    return response17 18 19st.set_page_config(page_title='Q&A Demo')20st.header("Simple Question and Answer App")21 22input = st.text_input("Write here:", key="input")23response = get_openai_response(input)24 25submit = st.button("What did you say?")26 27if submit:28    st.subheader("Hmmm... \n")29    st.write(response)