Ahtishamafzaal commited on
Commit
ff3d0ee
1 Parent(s): 60fde3d

Files Uploaded

Browse files
Files changed (2) hide show
  1. app.py +26 -0
  2. requirements.txt +5 -0
app.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #Q&A Chatbot
2
+ from langchain.llms import OpenAI
3
+ from dotenv import load_dotenv
4
+
5
+ load_dotenv()
6
+
7
+ import streamlit as st
8
+ import os
9
+
10
+ #Function to load OPENAI Model and get responses
11
+ def get_openai_response(question):
12
+ llm = OpenAI(model="gpt-3.5-turbo-instruct",temperature = 0.6, openai_api_key = os.environ["OPENAI_API_KEY"] )
13
+ response = llm(question)
14
+ return response
15
+
16
+ #Initialize our streamlit app
17
+ st.set_page_config(page_title="Q&A DEMO")
18
+ st.header("Langchain Application")
19
+
20
+ input = st.text_input("Input: " ,key="input")
21
+ response = get_openai_response(input)
22
+ sumbit = st.button("Ask the Question..")
23
+
24
+ if sumbit:
25
+ st.subheader("The response is ")
26
+ st.write(response)
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ langchain
2
+ openai
3
+ huggingface_hub
4
+ python_dotenv
5
+ streamlit