JagmeetMinhas22 commited on
Commit
545a5c8
·
verified ·
1 Parent(s): fb642b2

Rollback app.py to previous version

Browse files
Files changed (1) hide show
  1. app.py +4 -28
app.py CHANGED
@@ -1,34 +1,10 @@
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)
22
- #detailed_text = generated_text[0]['generated_text']
23
- #st.write("Generated Text:")
24
- #st.write(detailed_text)
25
-
26
- # Summarize the generated text
27
- summary = summarizer(prompt, max_length=130, min_length=30, do_sample=False)
28
- summarized_text = summary[0]['summary_text']
29
- st.write("Summarized Text:")
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")
 
 
1
  from transformers import pipeline
2
  import streamlit as st
 
3
 
 
 
 
 
4
  summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
5
 
6
+ textToParaphrase = st.text_input("Need to summarize lengthy text? Paste it here!")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
+ if textToParaphrase:
9
+ summary = summarizer(textToParaphrase, max_length=130, min_length=30, do_sample=False)
10
+ st.write(summary[0]['summary_text']) # Displaying the summarized text in Streamlit