|
import streamlit as st |
|
from transformers import pipeline |
|
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: |
|
|
|
answer = pipe(user_question, max_length=50, do_sample=True, top_k=50)[0]["generated_text"] |
|
st.write("Answer:") |
|
st.write(answer) |
|
else: |
|
st.warning("Please enter a question.") |
|
st.sidebar.header("Customize Appearance") |
|
bg_color = st.sidebar.color_picker("Background Color", "#f2f2f2") |
|
text_color = st.sidebar.color_picker("Text Color", "#000000") |
|
st.markdown(f'<style>body{{background-color: {bg_color}; color: {text_color}}}</style>', unsafe_allow_html=True) |
|
|