mkoot007 commited on
Commit
bcddb2d
·
1 Parent(s): bec6716

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -15
app.py CHANGED
@@ -1,23 +1,19 @@
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
- # Create a T5 text2text-generation pipeline
5
- pipe = pipeline("text2text-generation", model="kaist-ai/prometheus-13b-v1.0")
6
 
7
- # Define the Streamlit app
8
- st.title("Text Generation App")
9
 
10
- # Ask the user for input text
11
- user_input = st.text_area("Enter text:")
12
-
13
- # Generate text when the user clicks the button
14
- if st.button("Generate Text"):
15
- if user_input:
16
- # Use the specified pipeline to generate text
17
- generated_text = pipe(user_input, max_length=100, do_sample=True)[0]["generated_text"]
18
- st.write("Generated Text:")
19
- st.write(generated_text)
20
  else:
21
  st.warning("Please enter text.")
22
 
23
- # Customize the Streamlit app's appearance and other features as needed.
 
1
  import streamlit as st
2
  from transformers import pipeline
3
 
4
+ # Create a text2text-generation pipeline with the "google/flan-t5-base" model
5
+ pipe = pipeline("text2text-generation", model="google/flan-t5-base")
6
 
7
+ st.title("Text Explanation Model")
8
+ user_text = st.text_area("Enter text:")
9
 
10
+ if st.button("Generate Explanation"):
11
+ if user_text:
12
+ # Use the pipeline to generate an explanation for the input text
13
+ explanation = pipe(user_text, max_length=100, do_sample=True)[0]["generated_text"]
14
+ st.markdown("**Explanation:**")
15
+ st.markdown(explanation)
 
 
 
 
16
  else:
17
  st.warning("Please enter text.")
18
 
19
+ st.markdown("Use the 'Generate Explanation' button to generate an explanation for the provided text.")