File size: 810 Bytes
67448d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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:
        # Use the T5 model to generate an answer
        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)