File size: 749 Bytes
f2adb6c d5b17a3 f2adb6c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
import streamlit as st
from transformers import pipeline
pipe = pipeline("text2text-generation", model="google/flan-t5-base")
def generate_answer(question):
"""Generates an answer to a question using the T5 language model."""
answer = pipe(question, max_length=100, num_return_sequences=1)[0]
return answer
st.markdown(
f"""
<style>
body {{
background-image: url("BK.jpg");
background-size: cover;
}}
</style>
""",
unsafe_allow_html=True,
)
st.title("Question Answering App")
question = st.text_input("Ask me a question:")
if question:
answer = generate_answer(question)
st.markdown(f"**Answer:** {answer}")
else:
st.markdown("Please ask me a question.")
|