Kan05 commited on
Commit
b67361f
·
verified ·
1 Parent(s): 3db66e4

Upload 2 files

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
+ from langchain.llms import OpenAI
2
+ import streamlit as st
3
+ import os
4
+
5
+ ## Function to load OpenAI model and get responses
6
+
7
+ def get_openai_response(question):
8
+ llm = OpenAI(openai_api_key=os.getenv("OPENAI_API_KEY"), model_name="gpt-3.5-turbo-instruct", temperature=0.5)
9
+ response = llm(question)
10
+ return response
11
+
12
+ ##initialize our streamlit app
13
+
14
+ st.set_page_config(page_title="Q&A Demo")
15
+ st.header("Langchain Application")
16
+
17
+ input_text = st.text_input("Input: ", key="input")
18
+
19
+ submit = st.button("Ask the question")
20
+
21
+ ## If ask button is clicked
22
+
23
+ if submit:
24
+ response = get_openai_response(input_text)
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