Text2Text / app.py
mkoot007's picture
Update app.py
bc75555
raw
history blame
No virus
611 Bytes
import streamlit as st
from transformers import pipeline
# Create a text2text-generation pipeline with the "google/flan-t5-base" model
pipe = pipeline("text2text-generation", model="google/flan-t5-base")
st.title("Question-Answer Generator")
user_question = st.text_input("Ask a question:")
if st.button("Generate Answer"):
if user_question:
# Use the T5 model to generate a more precise answer
answer = pipe(user_question, max_length=100, do_sample=False)[0]["generated_text"]
st.write("Answer:")
st.write(answer)
else:
st.warning("Please enter a question.")