Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,27 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
-
# Create a
|
5 |
-
|
6 |
|
7 |
-
|
|
|
8 |
|
9 |
-
|
|
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
st.
|
17 |
-
st.markdown(paraphrase)
|
18 |
else:
|
19 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
4 |
+
# Create a text generation pipeline
|
5 |
+
pipe = pipeline("text-generation", model="ismaelfaro/gpt2-poems.en")
|
6 |
|
7 |
+
# Define the Streamlit app
|
8 |
+
st.title("Text Generation with Hugging Face Transformers")
|
9 |
|
10 |
+
# Input for user to provide a seed text
|
11 |
+
seed_text = st.text_input("Enter a seed text:")
|
12 |
|
13 |
+
# Button to generate text
|
14 |
+
if st.button("Generate Text"):
|
15 |
+
if seed_text:
|
16 |
+
generated_text = pipe(seed_text, max_length=50, do_sample=True)[0]['generated_text']
|
17 |
+
st.write("Generated Text:")
|
18 |
+
st.write(generated_text)
|
|
|
19 |
else:
|
20 |
+
st.write("Please enter a seed text to generate text.")
|
21 |
+
|
22 |
+
# Instructions and information
|
23 |
+
st.markdown("This app uses the Hugging Face Transformers library for text generation.")
|
24 |
+
st.markdown("Model: ismaelfaro/gpt2-poems.en")
|
25 |
+
|
26 |
+
# Provide additional information or options here
|
27 |
+
|