Spaces:
Sleeping
Sleeping
raul-padua
commited on
Commit
•
1e97e7e
1
Parent(s):
b5a482f
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Initialize the pipeline
|
5 |
+
pipe = pipeline("text2text-generation", model="google/flan-t5-base")
|
6 |
+
|
7 |
+
# Title of the app
|
8 |
+
st.title("Text-to-Text Generation with Google FLAN-T5")
|
9 |
+
|
10 |
+
# Text input for the user
|
11 |
+
input_text = st.text_area("Enter your text here:")
|
12 |
+
|
13 |
+
# Button to generate text
|
14 |
+
if st.button("Generate"):
|
15 |
+
if input_text:
|
16 |
+
# Generate text using the pipeline
|
17 |
+
output = pipe(input_text)
|
18 |
+
# Display the generated text
|
19 |
+
st.write("Generated Text:")
|
20 |
+
st.write(output[0]['generated_text'])
|
21 |
+
else:
|
22 |
+
st.write("Please enter some text to generate.")
|
23 |
+
|
24 |
+
# Additional information
|
25 |
+
st.markdown("""
|
26 |
+
This app uses the Google FLAN-T5 model to generate text based on the input provided.
|
27 |
+
Simply enter your text in the input box above and click on 'Generate' to see the output.
|
28 |
+
""")
|