0sparsh2 commited on
Commit
354cb8e
1 Parent(s): 5d1d795

app.py and Requirements added

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