mkoot007 commited on
Commit
67448d5
1 Parent(s): 00cff54

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+ pipe = pipeline("text2text-generation", model="google/flan-t5-base")
4
+
5
+ st.title("Question-Answer Generator")
6
+ user_question = st.text_input("Ask a question:")
7
+ if st.button("Generate Answer"):
8
+ if user_question:
9
+ # Use the T5 model to generate an answer
10
+ answer = pipe(user_question, max_length=50, do_sample=True, top_k=50)[0]["generated_text"]
11
+ st.write("Answer:")
12
+ st.write(answer)
13
+ else:
14
+ st.warning("Please enter a question.")
15
+ st.sidebar.header("Customize Appearance")
16
+ bg_color = st.sidebar.color_picker("Background Color", "#f2f2f2")
17
+ text_color = st.sidebar.color_picker("Text Color", "#000000")
18
+ st.markdown(f'<style>body{{background-color: {bg_color}; color: {text_color}}}</style>', unsafe_allow_html=True)