NovaAstro commited on
Commit
c467f2a
·
verified ·
1 Parent(s): 5fccdf4

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +31 -0
  2. requirements.txt +5 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain_community.llms import OpenAI
2
+
3
+ from dotenv import load_dotenv
4
+
5
+ load_dotenv()
6
+
7
+ import streamlit as st # importing stream lit
8
+ import os
9
+
10
+ # function to load OpenAI model and get response
11
+
12
+ def get_openai_response(question):
13
+ llm = OpenAI(openai_api_key = os.getenv("OPEN_API_KEY"),model_name = "gpt-3.5-turbo-instruct",temperature=0.4)
14
+ response = llm(question)
15
+ return response
16
+
17
+
18
+ # initialise our streamlit app
19
+
20
+ st.set_page_config(page_title="Q&A Demo")
21
+
22
+ st.header("Langchain Application ")
23
+
24
+ input = st.text_input("Input: ",key = "input")
25
+ response = get_openai_response(input)
26
+
27
+ submit = st.button("Ask the question")
28
+
29
+ if submit:
30
+ st.subheader("The Response is")
31
+ st.write(response)
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ langchain
2
+ openai # WE DON'T INSTALL IPYNB KERNEL BECAUSE IN REQUIREMENT BECAUSE WE DON'T NEED IT IN DEPLOYEMENT
3
+ huggingface_hub
4
+ python-dotenv
5
+ streamlit