Spaces:
Runtime error
Runtime error
Commit
·
68df196
1
Parent(s):
7b284f6
app script
Browse files- app.py +30 -0
- requirements.txt +2 -0
app.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from langchain import HuggingFaceHub
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
def get_answer(question,model):
|
| 6 |
+
return model(question)
|
| 7 |
+
|
| 8 |
+
def get_model():
|
| 9 |
+
model=HuggingFaceHub("google/flan-t5-small")
|
| 10 |
+
return model
|
| 11 |
+
|
| 12 |
+
st.set_page_config(
|
| 13 |
+
page_title="Simple Q&A App",
|
| 14 |
+
page_icon=":robot:"
|
| 15 |
+
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
st.header("Do It!!!!. Ask the Question.....")
|
| 19 |
+
|
| 20 |
+
question=st.text_input("Question:")
|
| 21 |
+
|
| 22 |
+
model=get_model()
|
| 23 |
+
|
| 24 |
+
submit=st.button("Submit")
|
| 25 |
+
|
| 26 |
+
if submit:
|
| 27 |
+
with st.spinner("In progress..."):
|
| 28 |
+
response=model(question)
|
| 29 |
+
|
| 30 |
+
st.text_area(f"{response}")
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
langchain
|