sanikamal commited on
Commit
79d37cc
·
verified ·
1 Parent(s): 2caacd8

Create app.py

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