gautamraj8044 commited on
Commit
d7739b7
1 Parent(s): 4d88e8e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +42 -4
app.py CHANGED
@@ -2,19 +2,57 @@ import streamlit as st
2
  import langchain
3
  from langchain.llms import HuggingFaceHub
4
 
 
5
  def load_answer(question):
6
  llm = HuggingFaceHub(repo_id="google/flan-t5-large")
7
- answer = llm(question)
8
  return answer
9
- st.set_page_config(page_title="LangChain Demo",page_icon=":robot:")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  st.header("LangChain Demo")
 
 
11
  def get_text():
12
- input_text = st.text_input("You",key="input")
13
  return input_text
14
 
 
15
  user_input=get_text()
16
  response = load_answer(user_input)
17
- submit = st.button("Generate")
 
 
 
18
  if submit:
 
19
  st.subheader("Answer:")
 
20
  st.write(response)
 
 
 
2
  import langchain
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="LangChain Demo", page_icon=":robot:")
14
+ st.header("LangChain Demo")
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
+
34
+
35
+
36
+ #App UI starts here
37
+ st.set_page_config(page_title="LangChain Demo", page_icon=":robot:")
38
  st.header("LangChain Demo")
39
+
40
+ #Gets the user input
41
  def get_text():
42
+ input_text = st.text_input("You: ", key="input")
43
  return input_text
44
 
45
+
46
  user_input=get_text()
47
  response = load_answer(user_input)
48
+
49
+ submit = st.button('Generate')
50
+
51
+ #If generate button is clicked
52
  if submit:
53
+
54
  st.subheader("Answer:")
55
+
56
  st.write(response)
57
+
58
+