avinashmhto commited on
Commit
0649337
·
1 Parent(s): 4dd1bf3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py CHANGED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+
4
+ from langchain.llms import OpenAI
5
+
6
+ #Function to return the response
7
+ def load_answer(question):
8
+ llm = HuggingFaceHub(repo_id="google/flan-t5-large",temperature=0)
9
+ answer=llm(question)
10
+ return answer
11
+
12
+
13
+ #App UI starts here
14
+ st.set_page_config(page_title="GloriaGPT Demo", page_icon=":robot:")
15
+ st.header("GloriaGPT Demo")
16
+
17
+ #Gets the user input
18
+ def get_text():
19
+ input_text = st.text_input("You: ", key="input")
20
+ return input_text
21
+
22
+
23
+ user_input=get_text()
24
+ response = load_answer(user_input)
25
+
26
+ submit = st.button('Generate')
27
+
28
+ #If generate button is clicked
29
+ if submit:
30
+
31
+ st.subheader("Answer:")
32
+
33
+ st.write(response)