thisisdev commited on
Commit
81cf284
·
verified ·
1 Parent(s): fe6ccc5

Application file

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from langchain_openai import OpenAI
3
+
4
+ # Creating a function for getting the responses from OpenAI
5
+ def get_response(question):
6
+ llm = OpenAI()
7
+ answer = llm.invoke(question)
8
+ return answer
9
+
10
+ # Using Streamlit for generation of page
11
+ st.set_page_config(page_title = "ASK GPT", page_icon = ":robot:")
12
+ st.header("ASK GPT Application")
13
+
14
+ # Create a function for taking user input
15
+ def get_user_input():
16
+ text = st.text_input("Ask: ", key = "input")
17
+ return text
18
+
19
+ user_input = get_user_input()
20
+ resp = get_response(user_input)
21
+
22
+ # Submission button
23
+ submit = st.button("Ask!")
24
+
25
+ if submit:
26
+ st.subheader("Answer: ")
27
+ st.write(resp)
28
+