File size: 809 Bytes
2b406c7
 
 
 
 
 
 
 
 
 
 
 
 
08eb1ee
2b406c7
 
08bb65d
2b406c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#Q&A Chatbot
##from langchain.llms import OpenAI
from langchain_community.llms import OpenAI
#from dotenv import load_dotenv
#from openai import OpenAI
import streamlit as st
import os


from urllib import response

#load_dotenv() # take environment variables from .env file.

#api_key = os.getenv("OPEN_API_KEY")

def get_openai_response(question):
    llm = OpenAI(temperature = 0.6)
    response =llm(question)
    return response

#intialize the streamlit app
st.set_page_config(page_title = "Q&A Chatbot Demo")

st.header("Small Q&A chatbot using Langchain and openAI")

input = st.text_input("Input:", key = "input")
answer = get_openai_response(input) 

submit = st.button("Ask the question")

#if button is clicked

if submit:
    st.subheader("Here is your answer")
    st.write(answer)