sancharikadebnath commited on
Commit
9c04fd0
1 Parent(s): 13b0c4e

Add application file

Browse files
Files changed (2) hide show
  1. app.py +24 -0
  2. requirements.txt +7 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain_community.llms import OpenAI
2
+ from dotenv import load_dotenv
3
+ import streamlit as st
4
+ import os
5
+ api_key = os.getenv('OPENAI_API_KEY')
6
+ load_dotenv()
7
+
8
+ def get_openai_response(question):
9
+ llm=OpenAI(openai_api_key=api_key,
10
+ temperature=0.6)
11
+ response=llm(question)
12
+ return response
13
+
14
+ st.set_page_config(page_title="Q&A")
15
+ st.header("Langchain Application")
16
+
17
+ input = st.text_input("Input: ", key="input")
18
+ response= get_openai_response(input)
19
+
20
+ submit=st.button("Ask the question")
21
+
22
+ if submit:
23
+ st.subheader("The Respose is:")
24
+ st.write(response)
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ langchain-community
2
+ langchain
3
+ openai
4
+ huggingface_hub
5
+ python-dotenv
6
+ streamlit
7
+ openai