Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,13 +26,13 @@ if st.button("Get Answer"):
|
|
26 |
with st.spinner("Generating answer..."):
|
27 |
try:
|
28 |
# Tokenize input
|
29 |
-
inputs =
|
30 |
|
31 |
# Generate answer
|
32 |
outputs = model_qna.generate(input_ids=inputs['input_ids'], attention_mask=inputs['attention_mask'], max_length=150)
|
33 |
|
34 |
# Decode the answer
|
35 |
-
answer =
|
36 |
|
37 |
# Display answer
|
38 |
st.subheader("Answer")
|
@@ -42,4 +42,8 @@ if st.button("Get Answer"):
|
|
42 |
else:
|
43 |
st.warning("Please enter a question for QnA.")
|
44 |
|
45 |
-
|
|
|
|
|
|
|
|
|
|
26 |
with st.spinner("Generating answer..."):
|
27 |
try:
|
28 |
# Tokenize input
|
29 |
+
inputs = tokenizer_qna(question_input, return_tensors='pt', max_length=512, truncation=True)
|
30 |
|
31 |
# Generate answer
|
32 |
outputs = model_qna.generate(input_ids=inputs['input_ids'], attention_mask=inputs['attention_mask'], max_length=150)
|
33 |
|
34 |
# Decode the answer
|
35 |
+
answer = tokenizer_qna.decode(outputs[0], skip_special_tokens=True)
|
36 |
|
37 |
# Display answer
|
38 |
st.subheader("Answer")
|
|
|
42 |
else:
|
43 |
st.warning("Please enter a question for QnA.")
|
44 |
|
45 |
+
# Optional: Add a footer or additional information
|
46 |
+
st.markdown("""
|
47 |
+
---
|
48 |
+
Made with ❤️ using [Streamlit](https://streamlit.io) and [Hugging Face Transformers](https://huggingface.co/transformers/).
|
49 |
+
""")
|