Spaces:
Runtime error
Runtime error
| import streamlit as st | |
| from transformers import pipeline | |
| # Set up a summarization pipeline | |
| 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]") | |