Spaces:
Sleeping
Sleeping
gautamraj8044
commited on
Commit
•
1079beb
1
Parent(s):
8bef103
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
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)
|