arnavpathak commited on
Commit
cd88d7c
·
verified ·
1 Parent(s): dc5949c

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
+ # Chat-Bot
2
+ from langchain.llms import OpenAI
3
+ from dotenv import load_dotenv
4
+ import streamlit as st
5
+ import os
6
+
7
+
8
+ load_dotenv()
9
+
10
+
11
+ def GetOpenaiResponse(question):
12
+ llm = OpenAI(
13
+ openai_api_key=os.getenv("OPENAI_API_KEY"),
14
+ temperature=0.6,
15
+ )
16
+ response = llm.invoke(question)
17
+ return response
18
+
19
+
20
+ st.set_page_config(page_title="Q&A Demo")
21
+ st.header("Langchain Application")
22
+
23
+ input = st.text_input("Input : ", key="input")
24
+ response = GetOpenaiResponse(input)
25
+
26
+
27
+ submit = st.button("Generate")
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
3
+ huggingface_hub
4
+ python-dotenv
5
+ streamlit