sunithalv commited on
Commit
815c96d
·
verified ·
1 Parent(s): 239427a

Upload 2 files

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