File size: 1,521 Bytes
6be5224
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import streamlit as st
from transformers import pipeline

# Set up a summarization pipeline
@st.cache_resource
def load_pipeline():
    return pipeline("text-generation", model="gpt-neo-125M")  # Small GPT model for simplicity

# Initialize the generator
text_generator = load_pipeline()

# Title
st.title("Presentation Generator App")

# Instructions
st.write("""
### Generate slides for your presentation
Enter the topic below, and the app will generate slide titles and content for your presentation.
""")

# Input: Topic of the presentation
topic = st.text_input("Enter the topic of your presentation:")

if st.button("Generate Slides"):
    if topic:
        # Generate content for the presentation
        st.subheader(f"Generated Slides for: {topic}")
        
        for i in range(1, 6):  # Generate 5 slides
            title_prompt = f"Generate a slide title for the topic: {topic}"
            content_prompt = f"Generate 3 bullet points for a slide about: {topic}"
            
            # Generate slide title
            slide_title = text_generator(title_prompt, max_length=15, num_return_sequences=1)[0]['generated_text']
            st.write(f"### Slide {i}: {slide_title}")
            
            # Generate slide content
            bullet_points = text_generator(content_prompt, max_length=50, num_return_sequences=1)[0]['generated_text']
            st.write(bullet_points)
    else:
        st.warning("Please enter a topic to generate slides.")

# Footer
st.write("Developed by [Your Name]")