ahsanengineer commited on
Commit
1bc91a4
1 Parent(s): 4297954

Upload 4 files

Browse files
Files changed (4) hide show
  1. .env +1 -0
  2. app.py +28 -0
  3. langchain.ipynb +0 -0
  4. requirement.txt +6 -0
.env ADDED
@@ -0,0 +1 @@
 
 
1
+ OPEN_AI_KEY=""
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain.llms import OpenAI
2
+ import streamlit as st
3
+ from dotenv import load_dotenv
4
+ load_dotenv()
5
+ import os
6
+ os.environ["OPEN_AI_KEY"]="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"
7
+
8
+ # print(llm.predict("what is the diffrence bw client and user"))
9
+
10
+ # create a openai question
11
+ def get_open_ai_response(question):
12
+
13
+ llm=OpenAI(openai_api_key=os.getenv("OPEN_AI_KEY"),temperature=0.6)
14
+ response=llm(question)
15
+ return response
16
+
17
+ # Build streamlit App
18
+ st.set_page_config(page_title="Q&A Application")
19
+ st.header("LangChain Application ")
20
+
21
+ input_text=st.text_input("Input: ",key="input")
22
+ response=get_open_ai_response(input_text)
23
+
24
+ submit=st.button("Ask the Question")
25
+
26
+ if submit:
27
+ st.subheader("The Response is ")
28
+ st.write(response)
langchain.ipynb ADDED
File without changes
requirement.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ langchain
2
+ openai
3
+ huggingface_hub
4
+
5
+ python_dotenv
6
+ streamlit