KrishnaMS commited on
Commit
adde775
·
1 Parent(s): 05fcbe8
Files changed (2) hide show
  1. app.py +30 -0
  2. requirements.txt +5 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain.llms import OpenAI
2
+
3
+ from dotenv import load_dotenv
4
+ from langchain import HuggingFaceHub
5
+ import os
6
+
7
+ load_dotenv()
8
+
9
+ import streamlit as st
10
+
11
+
12
+ def get_openai_response(question):
13
+ print(question)
14
+ llm=OpenAI(openai_api_key=os.getenv("OPEN_API_KEY"),model_name='text-davinci-003', temperature=0.6)
15
+ # response = llm_huggingface.predict(question[0])
16
+ response = llm(question)
17
+ return response
18
+
19
+ st.set_page_config(page_title='QA demo')
20
+
21
+ st.header('LangChain APP')
22
+
23
+ input = st.text_input("Input: ",key="input")
24
+ response=get_openai_response(input)
25
+
26
+ submit = st.button("Ask the question")
27
+
28
+ if submit:
29
+ st.subheader("The response is: ")
30
+ st.write(response)
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ langchain
2
+ openai
3
+ huggingface_hub
4
+ langchain_openai
5
+ google-cloud-aiplatform