Building an Elearning Course Creator with Streamlit and Lyzr Automata
Published: 2024-05-20 06:54:57

In the rapidly evolving landscape of education and professional development, the demand for tailored, high-quality Elearning courses has surged. Educational institutions, businesses, and individual educators are striving to create engaging and effective online courses that cater to specific audiences. However, the process of designing a comprehensive Elearning course — from defining learning objectives to structuring content and assessments — can be time-consuming, resource-intensive, and requires a high level of expertise.

**Problem**
Many educators and course creators face several challenges in developing Elearning courses:

**Time-Consuming Process:** Crafting a detailed course outline, including modules, lessons, and assessments, requires significant time and effort.
**Expertise Requirement:** Creating an effective Elearning course demands expertise in instructional design, subject matter, and understanding of the target audience.
**Resource Constraints:** Smaller institutions or individual educators often lack the resources to hire professional instructional designers.
**Consistency and Quality:** Ensuring consistent quality and pedagogical soundness across all modules of a course can be challenging, especially for those new to Elearning design.

**Objective**
To address these challenges, we aim to develop an automated solution that leverages artificial intelligence to streamline the Elearning course creation process. The solution should:

**Simplify Course Creation:** Allow users to quickly generate comprehensive course outlines by specifying the topic and target audience.
**Maintain High Quality:** Ensure that the generated courses are pedagogically sound and tailored to meet the needs of the specified audience.
**Reduce Time and Effort:** Significantly cut down the time and effort required to create a detailed course structure.
**Accessibility:** Make Elearning course creation accessible to educators and institutions with limited resources.

**Proposed Solution**
We propose the development of an Elearning Course Creator application that uses Streamlit for the user interface and Lyzr Automata, powered by OpenAI’s GPT-4, for the backend AI processing. This application will:

**User Input:** Collect user inputs for the course topic and target audience.
**AI-Driven Content Generation:** Utilize GPT-4 to generate course titles, learning objectives, module structures, lessons, assessment strategies, and anticipated impact based on the provided inputs.
**Interactive and User-Friendly:** Provide a simple, interactive interface for users to input their requirements and receive comprehensive course plans.
**Secure API Access:** Ensure secure handling of API keys and data throughout the process.
By implementing this solution, we aim to empower educators and course creators to produce high-quality Elearning content efficiently, thereby enhancing the overall educational experience for learners.

**Setting Up the Environment**
**Imports:**

Imports necessary libraries: streamlit, libraries from lyzr_automata

```
pip install lyzr_automata streamlit
```

```
import streamlit as st
from lyzr_automata.ai_models.openai import OpenAIModel
from lyzr_automata import Agent,Task
from lyzr_automata.pipelines.linear_sync_pipeline import LinearSyncPipeline
from PIL import Image
```
**Sidebar Configuration**
We create a sidebar for user inputs, including an API key input for accessing the OpenAI GPT-4 model. This ensures that the API key remains secure.

```
api = st.sidebar.text_input("Enter our OPENAI API KEY Here", type="password")

if api:
    openai_model = OpenAIModel(
        api_key=api,
        parameters={
            "model": "gpt-4-turbo-preview",
            "temperature": 0.2,
            "max_tokens": 1500,
        },
    )
else:
    st.sidebar.error("Please Enter Your OPENAI API KEY")
```
**Course Creation Function**
The course_creator function is responsible for generating the course. It defines the task and pipeline for the course creation process using Lyzr Automata.

```
def course_creator(topics, audiences):
    course_agent = Agent(
        prompt_persona="You Are Expert Elearning Course Creator",
        role="Course creator",
    )

    course_task = Task(
        name="Course Creation Task",
        output_type=OutputType.TEXT,
        input_type=InputType.TEXT,
        model=openai_model,
        agent=course_agent,
        log_output=True,
        instructions=f"""You are an Expert Elearning Course creator.Your task is to create course based on used given input topic and specific Audience.

        Input Requirements:
        Specific Topic: User Enters topic for which they want to create course
        Specific Audience: user specifies for which audience they are making this course
        
        Output Requirements:
        Course Title: Course title is SEO friendly and Eye Catchy for specific audience
        Learning Objectives: Specify Learning objectives from generated course.Make objectives point wise and give bullet points for sub sections.
        Course Structure: Specify Course Structure With Module and in each module specify lessons
        Assessment Strategies: Specify Assessment strategies
        Anticipated Impact: Specify Anticipated Impact by doing this course
        
        Below is User Input:
        Topic : {topics}
        Audience: {audiences}
        """,
    )

    output = LinearSyncPipeline(
        name="Generate Course",
        completion_message="Course Generated!",
        tasks=[course_task],
    ).run()
    return output[0]['task_output']
```
**User Input and Course Generation**
We use Streamlit’s input methods to capture the course topic and audience from the user. When the “Generate” button is clicked, the app calls the course_creator function and displays the generated course.

```
topic = st.text_input("Specify Topic", placeholder="Digital Marketing Fundamentals")
audience = st.text_input("Specify Audience", placeholder="Small business owners and entrepreneurs")

if api and st.button("Generate"):
    solution = course_creator(topic, audience)
    st.markdown(solution)
```
try it now: [https://lyzr-course-creator.streamlit.app/](https://lyzr-course-creator.streamlit.app/)

For more information explore the website: [Lyzr](https://www.lyzr.ai/)