Spaces:
Runtime error
Runtime error
DineshDyne
commited on
Commit
•
51ce215
1
Parent(s):
68df196
env config
Browse files- .env-sample +1 -0
- app.py +4 -7
- requirements.txt +2 -1
.env-sample
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
HUGGINGFACEHUB_API_TOKEN=""
|
app.py
CHANGED
@@ -2,12 +2,10 @@ import streamlit as st
|
|
2 |
from langchain import HuggingFaceHub
|
3 |
|
4 |
|
5 |
-
def get_answer(question,
|
|
|
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",
|
@@ -19,12 +17,11 @@ 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=
|
29 |
-
|
30 |
st.text_area(f"{response}")
|
|
|
2 |
from langchain import HuggingFaceHub
|
3 |
|
4 |
|
5 |
+
def get_answer(question,model_name="google/flan-t5-small"):
|
6 |
+
model=HuggingFaceHub(repo_id=model_name)
|
7 |
return model(question)
|
8 |
|
|
|
|
|
|
|
9 |
|
10 |
st.set_page_config(
|
11 |
page_title="Simple Q&A App",
|
|
|
17 |
|
18 |
question=st.text_input("Question:")
|
19 |
|
|
|
20 |
|
21 |
submit=st.button("Submit")
|
22 |
|
23 |
if submit:
|
24 |
with st.spinner("In progress..."):
|
25 |
+
response=get_answer(question)
|
26 |
+
st.subheader("Response")
|
27 |
st.text_area(f"{response}")
|
requirements.txt
CHANGED
@@ -1,2 +1,3 @@
|
|
1 |
streamlit
|
2 |
-
langchain
|
|
|
|
1 |
streamlit
|
2 |
+
langchain
|
3 |
+
huggingface-hub
|