Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,21 @@
|
|
|
|
1 |
from transformers import pipeline
|
2 |
import streamlit as st
|
3 |
from diffusers import DiffusionPipeline
|
4 |
|
5 |
-
#
|
6 |
generator = pipeline("text-generation", model="mosaicml/mpt-7b-storywriter", trust_remote_code=True)
|
7 |
|
8 |
-
#
|
9 |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
10 |
|
11 |
# Image generation pipeline
|
12 |
-
image_pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev")
|
13 |
|
14 |
# Input text
|
15 |
prompt = st.text_input("Enter a prompt to expand on:")
|
16 |
|
|
|
17 |
if prompt:
|
18 |
# Generate text based on the prompt
|
19 |
generated_text = generator(prompt, max_length=300, num_return_sequences=1)
|
@@ -28,5 +30,5 @@ if prompt:
|
|
28 |
st.write(summarized_text)
|
29 |
|
30 |
# Generate an image from the summarized text
|
31 |
-
image = image_pipe(summarized_text).images[0]
|
32 |
-
st.image(image, caption="Generated Image")
|
|
|
1 |
+
#Import dependencies
|
2 |
from transformers import pipeline
|
3 |
import streamlit as st
|
4 |
from diffusers import DiffusionPipeline
|
5 |
|
6 |
+
#Text generation pipeline
|
7 |
generator = pipeline("text-generation", model="mosaicml/mpt-7b-storywriter", trust_remote_code=True)
|
8 |
|
9 |
+
#Summarization pipeline
|
10 |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
|
11 |
|
12 |
# Image generation pipeline
|
13 |
+
#image_pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev")
|
14 |
|
15 |
# Input text
|
16 |
prompt = st.text_input("Enter a prompt to expand on:")
|
17 |
|
18 |
+
#Check if text has been entered into the prompt
|
19 |
if prompt:
|
20 |
# Generate text based on the prompt
|
21 |
generated_text = generator(prompt, max_length=300, num_return_sequences=1)
|
|
|
30 |
st.write(summarized_text)
|
31 |
|
32 |
# Generate an image from the summarized text
|
33 |
+
#image = image_pipe(summarized_text).images[0]
|
34 |
+
#st.image(image, caption="Generated Image")
|