File size: 647 Bytes
a2088b7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from langchain.llms import OpenAI
from dotenv import load_dotenv
load_dotenv()
import streamlit as st
import os


# Function to load OpenAI model and get response
def get_openAI_respnse(question):
    llm = OpenAI(model_name="text-davinci-003", temperature=0.5)
    response = llm(question)
    return response


## Intitialize Streamlit app
st.set_page_config(page_title = "Q&A Demo")
st.header("LangChain App")

input = st.text_input("Enter your question here", key="input")
response = get_openAI_respnse(input)

submit = st.button("Generate")


#If submit button is clicked
if submit:
    st.subheader("The response is")
    st.write(response)