sushk0317 commited on
Commit
987f9a5
·
verified ·
1 Parent(s): 6891be3

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +27 -0
  2. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain.llms import OpenAI
2
+ # from dotenv import load_dotenv
3
+ import streamlit as st
4
+ import os
5
+
6
+ # load_dotenv() #take environment variables from .env.
7
+
8
+ #function to load OpenAI model and get responses
9
+ def get_openai_response(question):
10
+ response = llm(question)
11
+ return response
12
+
13
+ #initialize our streamlit app
14
+ st.set_page_config(page_title="Q&A Demo")
15
+ st.header("Langchain Application")
16
+
17
+ input = st.text_input("Input: ", key="input")
18
+
19
+ submit = st.button("Ask the question")
20
+
21
+ llm = OpenAI(openai_api_key=os.getenv("OPEN_API_KEY"), model_name="gpt-3.5-turbo-instruct", temperature=0.5)
22
+
23
+ if submit:
24
+ st.subheader("The Response is")
25
+
26
+ response = get_openai_response(input)
27
+ st.write(response)
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ langchain
2
+ openai
3
+ streamlit
4
+ huggingface_hub