Spaces:
Runtime error
Runtime error
File size: 586 Bytes
cd88d7c 2d82709 cd88d7c 2d82709 cd88d7c | 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 | # Chat-Bot
from langchain.llms import OpenAI
from dotenv import load_dotenv
import streamlit as st
import os
load_dotenv()
def GetOpenaiResponse(question):
llm = OpenAI(
openai_api_key=os.getenv("OPENAI_API_KEY"),
temperature=0.6,
)
response = llm.invoke(question)
return response
st.set_page_config(page_title="Q&A Demo")
st.header("Ask a question")
input = st.text_input("Input : ", key="input")
response = GetOpenaiResponse(input)
submit = st.button("Generate Answer")
if submit:
st.subheader("The response is :")
st.write(response)
|