singla commited on
Commit
750a61d
1 Parent(s): 09d337c

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +27 -0
  2. requirements.txt +5 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Q&A Chatbot
2
+ from langchain.llms import OpenAI
3
+ from dotenv import load_dotenv
4
+
5
+ load_dotenv()
6
+
7
+ import streamlit as st
8
+ import os
9
+
10
+ ##Function to load Open AI model and get response
11
+
12
+ def get_openai_response(question):
13
+ llm = OpenAI(openai_api_key=os.getenv("OPEN_API_KEY"), model_name = "text-davinci-003", temperature = 0.6)
14
+ response = llm(question)
15
+ return response
16
+
17
+ ## Intialize streamlit app
18
+ st.set_page_config(page_title = "Q& A Demo")
19
+ st.header("LangChain Application")
20
+
21
+ input = st.text_input("Input: ", key = "input")
22
+ response = get_openai_response(input)
23
+
24
+ submit= st.button("Ask the Question")
25
+ if submit:
26
+ st.subheader("The response is")
27
+ st.write(response)
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ langchain
2
+ openai
3
+ huggingface_hub
4
+ python-dotenv
5
+ streamlit