beingtarunteja commited on
Commit
44fef92
·
1 Parent(s): 2103d7d

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +30 -0
  2. requirements.txt +5 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Q&A ChatBot
2
+ from langchain.llms import OpenAI
3
+ from dotenv import load_dotenv
4
+
5
+ load_dotenv() # take environment varialbes from .env
6
+
7
+ import streamlit as st
8
+ import os
9
+
10
+
11
+ ## Function to load OpenAi model and get responses
12
+
13
+ def get_open_response(question):
14
+ llm= OpenAI(openai_api_key=os.getenv("OPEN_API_KEY"), model_name="text-davinci-003", temperature=0.5)
15
+ response=llm(question)
16
+ return response
17
+
18
+ ## Initialise our streamlit app
19
+ st.set_page_config(page_title="Q&A Demo")
20
+ st.header("Langchain Application")
21
+
22
+ input = st.text_input("Input: ", key="input")
23
+ response = get_open_response(input)
24
+ submit = st.button("Generate")
25
+
26
+ ## If Generate button is clicked
27
+
28
+ if submit:
29
+ st.subheader("The Reponse is")
30
+ st.write(response)
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ langchain
2
+ openai
3
+ huggingface_hub
4
+ python-dotenv
5
+ streamlit