diff --git a/generate_base_questions.py b/generate_base_questions.py index f33e91a..2658b91 100644 --- a/generate_base_questions.py +++ b/generate_base_questions.py @@ -13,196 +13,7 @@ cred = credentials.Certificate(os.getenv("GOOGLE_APPLICATION_CREDENTIALS")) firebase_admin.initialize_app(cred) -reading_to_insert_1 = { - "exercises": [ - { - "allowRepetition": True, - "id": str(uuid.uuid4()), - "prompt": "Complete the summary below. Click a blank to select the corresponding word(s) for it.\\nThere are " - "more words than spaces so you will not use them all. You may use any of the words more than once.", - "solutions": [ - { - "id": "1", - "solution": "clean" - }, - { - "id": "2", - "solution": "fossil" - }, - { - "id": "3", - "solution": "sunlight" - }, - { - "id": "4", - "solution": "alternative" - }, - { - "id": "5", - "solution": "solar" - }, - { - "id": "6", - "solution": "wind farms" - }, - { - "id": "7", - "solution": "source" - }, - { - "id": "8", - "solution": "flowing water" - } - ], - "text": "In recent years, the transition to {{1}} energy sources has surged, driven by growing concerns about " - "{{2}} fuels and their impact on climate change. Renewable options, including {{3}}, wind, and water," - " are gaining momentum as a cleaner {{4}} to conventional energy production. Solar panels, harnessing {{5}} " - "energy, are becoming more accessible, while wind turbines in {{6}} are providing a scalable and sustainable " - "{{7}} of power. Moreover, hydropower, derived from {{8}}, contributes to the renewable energy landscape, " - "offering a multifaceted approach to combat environmental challenges.", - "type": "fillBlanks", - "words": ["energy", "fossil", "alternative", "transition", "wind farms", "source", - "contributes", "flowing water", "surged", "momentum", "scalable", "solar", "accessible", - "climate", - "environmental", "renewable", "impact", "clean", "options", "challenges"] - - }, - { - "id": str(uuid.uuid4()), - "prompt": "Select the appropriate option.", - "questions": [ - { - "id": 1, - "options": [ - { - "id": "A", - "text": "Economic benefits" - }, - { - "id": "B", - "text": "Government regulations" - }, - { - "id": "C", - "text": "Concerns about climate change" - }, - { - "id": "D", - "text": "Technological advancement" - } - ], - "prompt": "What is the main reason for the shift towards renewable energy sources?", - "solution": "C", - "variant": "text", - }, - { - "id": 2, - "options": [ - { - "id": "A", - "text": "Wind" - }, - { - "id": "B", - "text": "Coal" - }, - { - "id": "C", - "text": "Sunlight" - }, - { - "id": "D", - "text": "Water" - } - ], - "prompt": "Which of the following sources is NOT mentioned as a renewable energy source?", - "solution": "B", - "variant": "text", - }, - { - "id": 3, - "options": [ - { - "id": "A", - "text": "It generates a lot of waste" - }, - { - "id": "B", - "text": "It produces greenhouse gases" - }, - { - "id": "C", - "text": "It has no emissions" - }, - { - "id": "D", - "text": "It requires large land areas" - } - ], - "prompt": "What advantage does solar energy have in terms of environmental impact?", - "solution": "C", - "variant": "text", - }, - { - "id": 4, - "options": [ - { - "id": "A", - "text": "By burning fossil fuels" - }, - { - "id": "B", - "text": "By harnessing wind's kinetic energy" - }, - { - "id": "C", - "text": "By using sunlight" - }, - { - "id": "D", - "text": "By utilizing underground heat" - } - ], - "prompt": "How do wind turbines generate electricity?", - "solution": "B", - "variant": "text", - } - ], - "type": "multipleChoice", - } - ], - "isDiagnostic": True, - "minTimer": 20, - "text": { - "content": "In recent years, there has been a significant shift towards renewable energy sources as societies " - "strive to reduce their dependence on fossil fuels and combat the effects of climate change. Renewable " - "energy, derived from sources such as sunlight, wind, and water, offers a promising alternative to " - "traditional energy generation methods.\\nSolar power, harnessed from the sun's rays, has gained immense " - "popularity. Photovoltaic cells, commonly known as solar panels, capture sunlight and convert it into " - "electricity. This technology has become more efficient and affordable, contributing to a growing number " - "of solar installations on rooftops and solar farms. Solar energy not only reduces greenhouse gas " - "emissions but also grants individuals and businesses the ability to generate their own power.\\nSimilarly, " - "wind energy has emerged as a reliable and clean source of electricity. Wind turbines, often found in " - "wind farms, harness the kinetic energy of moving air to turn blades and generate electricity. These " - "structures are strategically placed in areas with consistent wind patterns, contributing to the overall " - "energy grid. Wind power has the advantage of scalability, with both small and large installations being " - "feasible options.\\nHydropower, generated from flowing water in rivers and dams, is another vital renewable " - "energy source. The force of water is used to turn turbines, which then produce electricity. While hydropower " - "has a long history, advancements in technology have led to more efficient and environmentally friendly " - "designs. However, the construction of dams for hydropower can have significant ecological and social " - "impacts, requiring careful consideration.\\nGeothermal energy, originating from the Earth's heat, is " - "also gaining attention. This energy source is harnessed through underground steam and hot water reservoirs, " - "which are tapped for electricity generation and heating. Geothermal power plants have a relatively small " - "environmental footprint and provide a consistent source of energy, making them a viable option in regions " - "with suitable geological conditions.\\nIn conclusion, the transition to renewable energy sources marks a " - "pivotal step towards sustainable and environmentally conscious energy generation. Solar, wind, hydropower, " - "and geothermal energy offer diverse options that can collectively contribute to reducing carbon emissions " - "and combating climate change. As technology continues to evolve and economies adapt, the potential for " - "widespread adoption of renewable energy remains promising.", - "title": "The Rise of Renewable Energy" - }, - "type": "academic" -} +# LEGACY reading_to_insert_2 = { "exercises": [ { @@ -646,7 +457,7 @@ reading_p1_to_insert_2 = { "critical social, environmental, and ethical concerns that continue to resonate in today's world. " "Understanding the multifaceted impacts of the Industrial Revolution is essential for comprehending " "the foundations of the modern global landscape.", - "title": "The Importance of Bees in Ecosystems" + "title": "The Industrial Revolution" }, "type": "academic" } @@ -2115,6 +1926,667 @@ listening_section_2_to_insert_5 = { "section": 2 } + +# NEW +reading_to_insert_1 = { + "parts": [ + { + "exercises": [ + { + "allowRepetition": True, + "id": str(uuid.uuid4()), + "prompt": "Complete the summary below. Click a blank to select the corresponding word(s) for it.\\nThere are " + "more words than spaces so you will not use them all. You may use any of the words more than once.", + "solutions": [ + { + "id": "1", + "solution": "clean" + }, + { + "id": "2", + "solution": "fossil" + }, + { + "id": "3", + "solution": "sunlight" + }, + { + "id": "4", + "solution": "alternative" + }, + { + "id": "5", + "solution": "solar" + }, + { + "id": "6", + "solution": "wind farms" + }, + { + "id": "7", + "solution": "source" + }, + { + "id": "8", + "solution": "flowing water" + } + ], + "text": "In recent years, the transition to {{1}} energy sources has surged, driven by growing concerns about " + "{{2}} fuels and their impact on climate change. Renewable options, including {{3}}, wind, and water," + " are gaining momentum as a cleaner {{4}} to conventional energy production. Solar panels, harnessing {{5}} " + "energy, are becoming more accessible, while wind turbines in {{6}} are providing a scalable and sustainable " + "{{7}} of power. Moreover, hydropower, derived from {{8}}, contributes to the renewable energy landscape, " + "offering a multifaceted approach to combat environmental challenges.", + "type": "fillBlanks", + "words": ["energy", "fossil", "alternative", "transition", "wind farms", "source", + "contributes", "flowing water", "surged", "momentum", "scalable", "solar", "accessible", + "climate", + "environmental", "renewable", "impact", "clean", "options", "challenges"] + + }, + { + "id": str(uuid.uuid4()), + "prompt": "Select the appropriate option.", + "questions": [ + { + "id": "9", + "options": [ + { + "id": "A", + "text": "Economic benefits" + }, + { + "id": "B", + "text": "Government regulations" + }, + { + "id": "C", + "text": "Concerns about climate change" + }, + { + "id": "D", + "text": "Technological advancement" + } + ], + "prompt": "What is the main reason for the shift towards renewable energy sources?", + "solution": "C", + "variant": "text", + }, + { + "id": "10", + "options": [ + { + "id": "A", + "text": "Wind" + }, + { + "id": "B", + "text": "Coal" + }, + { + "id": "C", + "text": "Sunlight" + }, + { + "id": "D", + "text": "Water" + } + ], + "prompt": "Which of the following sources is NOT mentioned as a renewable energy source?", + "solution": "B", + "variant": "text", + }, + { + "id": "11", + "options": [ + { + "id": "A", + "text": "It generates a lot of waste" + }, + { + "id": "B", + "text": "It produces greenhouse gases" + }, + { + "id": "C", + "text": "It has no emissions" + }, + { + "id": "D", + "text": "It requires large land areas" + } + ], + "prompt": "What advantage does solar energy have in terms of environmental impact?", + "solution": "C", + "variant": "text", + }, + { + "id": "12", + "options": [ + { + "id": "A", + "text": "By burning fossil fuels" + }, + { + "id": "B", + "text": "By harnessing wind's kinetic energy" + }, + { + "id": "C", + "text": "By using sunlight" + }, + { + "id": "D", + "text": "By utilizing underground heat" + } + ], + "prompt": "How do wind turbines generate electricity?", + "solution": "B", + "variant": "text", + }, + { + "id": "13", + "options": [ + { + "id": "A", + "text": "Increasing greenhouse gas emissions and worsening climate change" + }, + { + "id": "B", + "text": "Depleting fossil fuel reserves and causing energy shortages" + }, + { + "id": "C", + "text": "Accelerating deforestation and harming ecosystems" + }, + { + "id": "D", + "text": "Reducing carbon emissions and combating climate change" + } + ], + "prompt": "What do renewable energies contribute to?", + "solution": "D", + "variant": "text", + } + ], + "type": "multipleChoice", + } + ], + "text": { + "content": "In recent years, there has been a significant shift towards renewable energy sources as societies " + "strive to reduce their dependence on fossil fuels and combat the effects of climate change. Renewable " + "energy, derived from sources such as sunlight, wind, and water, offers a promising alternative to " + "traditional energy generation methods.\\nSolar power, harnessed from the sun's rays, has gained immense " + "popularity. Photovoltaic cells, commonly known as solar panels, capture sunlight and convert it into " + "electricity. This technology has become more efficient and affordable, contributing to a growing number " + "of solar installations on rooftops and solar farms. Solar energy not only reduces greenhouse gas " + "emissions but also grants individuals and businesses the ability to generate their own power.\\nSimilarly, " + "wind energy has emerged as a reliable and clean source of electricity. Wind turbines, often found in " + "wind farms, harness the kinetic energy of moving air to turn blades and generate electricity. These " + "structures are strategically placed in areas with consistent wind patterns, contributing to the overall " + "energy grid. Wind power has the advantage of scalability, with both small and large installations being " + "feasible options.\\nHydropower, generated from flowing water in rivers and dams, is another vital renewable " + "energy source. The force of water is used to turn turbines, which then produce electricity. While hydropower " + "has a long history, advancements in technology have led to more efficient and environmentally friendly " + "designs. However, the construction of dams for hydropower can have significant ecological and social " + "impacts, requiring careful consideration.\\nGeothermal energy, originating from the Earth's heat, is " + "also gaining attention. This energy source is harnessed through underground steam and hot water reservoirs, " + "which are tapped for electricity generation and heating. Geothermal power plants have a relatively small " + "environmental footprint and provide a consistent source of energy, making them a viable option in regions " + "with suitable geological conditions.\\nIn conclusion, the transition to renewable energy sources marks a " + "pivotal step towards sustainable and environmentally conscious energy generation. Solar, wind, hydropower, " + "and geothermal energy offer diverse options that can collectively contribute to reducing carbon emissions " + "and combating climate change. As technology continues to evolve and economies adapt, the potential for " + "widespread adoption of renewable energy remains promising.", + "title": "The Rise of Renewable Energy" + }, + }, + { + "exercises": [ + { + "id": str(uuid.uuid4()), + "prompt": "Do the following statements agree with the information given in Reading Passage 2?", + "questions": [ + { + "id": "14", + "prompt": "The Industrial Revolution occurred during the 19th century.", + "solution": "true" + }, + { + "id": "15", + "prompt": "The mechanization of production processes during the Industrial Revolution mainly brought improvements to manual labor.", + "solution": "false" + }, + { + "id": "16", + "prompt": "Urbanization, resulting from the Industrial Revolution, led to increased pollution and improved living conditions in cities.", + "solution": "not_given" + }, + { + "id": "17", + "prompt": "Innovations like the steam engine and power loom brought automation to industries that previously relied solely on manual labor.", + "solution": "true" + }, + { + "id": "18", + "prompt": "Child labor and poor working conditions were not significant issues during the Industrial Revolution.", + "solution": "false" + }, + { + "id": "19", + "prompt": "The Industrial Revolution had no impact on intellectual and cultural aspects of society.", + "solution": "false" + } + ], + "type": "trueFalse" + }, + { + "id": str(uuid.uuid4()), + "prompt": "Select the appropriate option.", + "questions": [ + { + "id": "20", + "options": [ + { + "id": "A", + "text": "Enhancing economic growth" + }, + { + "id": "B", + "text": "Ensuring cultural diversity" + }, + { + "id": "C", + "text": "Safeguarding individual dignity and worth" + }, + { + "id": "D", + "text": "Promoting political ideologies" + } + ], + "prompt": "What is the central purpose of human rights, according to the passage?", + "solution": "C", + "variant": "text", + }, + { + "id": "21", + "options": [ + { + "id": "A", + "text": "Economic rights" + }, + { + "id": "B", + "text": "Political rights" + }, + { + "id": "C", + "text": "Social rights" + }, + { + "id": "D", + "text": "Cultural rights" + } + ], + "prompt": "Which rights enable citizens to participate in governance and express opinions freely?", + "solution": "B", + "variant": "text", + }, + { + "id": "22", + "options": [ + { + "id": "A", + "text": "Ignoring human rights abuses" + }, + { + "id": "B", + "text": "Upholding human rights and preventing abuses" + }, + { + "id": "C", + "text": "Encouraging social unrest" + }, + { + "id": "D", + "text": "Perpetrating human rights violations" + } + ], + "prompt": "What role do international organizations and treaties play in relation to human rights?", + "solution": "B", + "variant": "text", + }, + { + "id": "23", + "options": [ + { + "id": "A", + "text": "Promoting social unrest" + }, + { + "id": "B", + "text": "Leading to instability" + }, + { + "id": "C", + "text": "Causing conflicts" + }, + { + "id": "D", + "text": "Fostering stability and justice" + } + ], + "prompt": "What impact does respecting human rights have on societies, as mentioned in the passage?", + "solution": "D", + "variant": "text", + } + ], + "type": "multipleChoice", + }, + { + "id": str(uuid.uuid4()), + "maxWords": 3, + "prompt": "Choose no more than three words and/or a number from the passage for each answer.", + "solutions": [ + { + "id": "24", + "options": ["mechanization", "steam engine", "power loom"] + }, + { + "id": "25", + "options": ["urbanization", "overcrowding", "poor working conditions"] + }, + { + "id": "26", + "options": ["telegraph", "long-distance communication"] + }, + ], + "text": "What innovations brought automation to industries?{{24}}\\nWhat were some of the challenges " + "resulting from rural populations moving to urban areas?{{25}}\\nWhat technological " + "advancement transformed long-distance communication?{{26}}", + "type": "writeBlanks" + } + ], + "text": { + "content": "The Industrial Revolution, a defining chapter in human history, sparked profound changes in the way " + "societies operated and interacted with their environment. This period, which spanned from the late " + "18th to the 19th century, marked a remarkable shift from agrarian economies to industrialized ones. " + "The effects of this revolution continue to shape the modern world.\\nThe key catalyst of the Industrial " + "Revolution was the mechanization of production processes. Innovations such as the steam engine, " + "spinning jenny, and power loom brought automation and efficiency to industries that had long relied " + "on manual labor. This transformation had far-reaching consequences, drastically altering economic " + "structures and social dynamics.\\nFactories emerged as centers of production, drawing rural populations " + "to urban areas in search of work. Urbanization surged as people migrated from countryside villages " + "to cities in pursuit of employment opportunities. This shift gave rise to new challenges, including " + "overcrowding, inadequate living conditions, and increased pollution. At the same time, it paved the " + "way for the growth of the working class and the development of labor movements advocating for improved " + "working conditions.\\nThe Industrial Revolution also revolutionized transportation and communication. " + "The invention of the steam-powered locomotive and the expansion of railway networks facilitated the " + "movement of goods and people at an unprecedented pace. Additionally, the telegraph brought about " + "almost instantaneous long-distance communication, transforming the way information was disseminated." + "\\nWhile the Industrial Revolution brought significant advancements, it was not without drawbacks. " + "The rapid industrialization led to environmental degradation as factories emitted pollutants into the " + "air and water. This had adverse effects on public health and ecosystems. Child labor and poor working " + "conditions were also prevalent, prompting social reform movements and labor unions to demand better " + "treatment and protection for workers.\\nThe Industrial Revolution not only transformed economies and " + "societies but also spurred intellectual and cultural changes. Scientific discoveries and technological " + "innovations inspired new philosophies, such as capitalism and socialism, which shaped economic and " + "political ideologies. Literature, art, and education adapted to the changing times, reflecting both " + "the marvels and challenges of the industrial age.\\nIn conclusion, the Industrial Revolution stands " + "as a pivotal period that propelled societies into a new era of industrialization and urbanization. " + "While it brought about unprecedented economic growth and technological advancement, it also raised " + "critical social, environmental, and ethical concerns that continue to resonate in today's world. " + "Understanding the multifaceted impacts of the Industrial Revolution is essential for comprehending " + "the foundations of the modern global landscape.", + "title": "The Industrial Revolution" + }, + }, + { + "exercises": [ + { + "allowRepetition": True, + "id": str(uuid.uuid4()), + "prompt": "Complete the summary below. Click a blank to select the corresponding word(s) for it.\\nThere " + "are more words than spaces so you will not use them all. You may use any of the words more than once.", + "solutions": [ + { + "id": "27", + "solution": "ships" + }, + { + "id": "28", + "solution": "harsh" + }, + { + "id": "29", + "solution": "Arabian" + }, + { + "id": "30", + "solution": "Silk" + }, + { + "id": "31", + "solution": "dromedary" + }, + { + "id": "32", + "solution": "trade" + }, + { + "id": "33", + "solution": "religion" + }, + { + "id": "34", + "solution": "desert" + } + ], + "text": "Camels, often called the '{{27}} of the desert' have a rich history and cultural significance " + "in many regions. They have adapted to {{28}} environments and played a crucial role in human " + "societies. Camels were first domesticated around 4,000 years ago in the {{29}} Peninsula, " + "primarily as pack animals for carrying goods across arid terrains, notably along trade routes " + "like the {{30}} Road. There are two main species: the {{31}} with one hump and the Bactrian " + "camel with two humps, each adapted to its respective environment. Camels facilitated {{32}}, " + "transportation, and cultural exchange among civilizations. Nomadic communities relied on them " + "for transport, food, materials, and nutrition. Camels also hold symbolic importance in folklore, " + "{{33}}, and ancient texts. Today, while their trade role has diminished, they remain " + "vital for {{34}} travel and community livelihoods, embodying the enduring bond between humans " + "and these remarkable creatures in challenging environments.", + "type": "fillBlanks", + "words": ["camel", "dromedary", "trade", "desert", "ships", "resilience", "religion", "nutrition", + "Arabian", "adaptability", "culture", "Silk", "harsh"] + }, + { + "id": str(uuid.uuid4()), + "prompt": "Select the appropriate option.", + "questions": [ + { + "id": "35", + "options": [ + { + "id": "A", + "text": "They were the fastest animals in the desert." + }, + { + "id": "B", + "text": "They were symbols of wealth." + }, + { + "id": "C", + "text": "They played a pivotal role in history and culture." + }, + { + "id": "D", + "text": "They were used primarily for entertainment." + } + ], + "prompt": "What is the historical significance of camels mentioned in the text?", + "solution": "C", + "variant": "text" + }, + { + "id": "36", + "options": [ + { + "id": "A", + "text": "North Africa" + }, + { + "id": "B", + "text": "Central Asia" + }, + { + "id": "C", + "text": "The Silk Road" + }, + { + "id": "D", + "text": "The Arabian Peninsula" + } + ], + "prompt": "According to the text, where is the earliest evidence of camel domestication found?", + "solution": "D", + "variant": "text" + }, + { + "id": "37", + "options": [ + { + "id": "A", + "text": "Transportation" + }, + { + "id": "B", + "text": "Food source" + }, + { + "id": "C", + "text": "Communication" + }, + { + "id": "D", + "text": "Material production" + } + ], + "prompt": "Which of the following is NOT mentioned as a use of camels in the text?", + "solution": "C", + "variant": "text" + }, + { + "id": "38", + "options": [ + { + "id": "A", + "text": "One" + }, + { + "id": "B", + "text": "Three" + }, + { + "id": "C", + "text": "Two" + }, + { + "id": "D", + "text": "Four" + } + ], + "prompt": "How many species of camels are mentioned in the text?", + "solution": "C", + "variant": "text" + }, + { + "id": "39", + "options": [ + { + "id": "A", + "text": "North Africa" + }, + { + "id": "B", + "text": "Central Asia" + }, + { + "id": "C", + "text": "The Middle East" + }, + { + "id": "D", + "text": "The Arabian Peninsula" + } + ], + "prompt": "In which part of the world is the Bactrian camel found, as mentioned in the text?", + "solution": "B", + "variant": "text" + }, + { + "id": "40", + "options": [ + { + "id": "A", + "text": "They discouraged trade due to their slow pace." + }, + { + "id": "B", + "text": "They facilitated trade by carrying goods." + }, + { + "id": "C", + "text": "They were primarily used as guards for trade caravans." + }, + { + "id": "D", + "text": "They transported only lightweight goods." + } + ], + "prompt": "What role did camels play in trade, according to the text?", + "solution": "B", + "variant": "text" + } + ], + "type": "multipleChoice", + } + ], + "text": { + "content": "Camels, often referred to as the 'ships of the desert', have played a pivotal role in the " + "history and culture of many regions. These unique creatures have adapted to some of the " + "harshest environments on Earth, and their domestication has had a profound impact on human " + "societies.\\nThe history of the camel dates back thousands of years. The earliest evidence " + "of camel domestication can be traced to the Arabian Peninsula around 4,000 years ago. " + "Initially, camels were used primarily as pack animals, carrying goods across arid landscapes. " + "Their ability to endure long journeys without water made them invaluable to ancient trade " + "routes, such as the famous Silk Road.\\nCamels come in two main species: the dromedary, " + "with a single hump, and the Bactrian camel, with two humps. While the dromedary is native " + "to North Africa and the Middle East, the Bactrian camel is found in Central Asia. Each species " + "has its unique characteristics and adaptations suited to its respective environment.\\nThe " + "spread of camels and their use in trade and transportation significantly influenced the " + "development of civilizations. They not only facilitated the exchange of goods but also enabled" + " the movement of people, leading to cultural diffusion and the sharing of knowledge and ideas." + "\\nIn addition to their role in trade, camels have also been integral to the survival of " + "nomadic communities. Nomads in various parts of the world have relied on camels for transportation, " + "food, and materials such as wool and leather. Their milk, which is a valuable source of " + "nutrition in arid regions, has sustained generations of desert-dwelling peoples.\\nCamels " + "have left their mark on folklore and religion as well. They feature prominently in the stories" + " and traditions of many cultures, often symbolizing endurance, resilience, and adaptability. " + "In some religions, camels hold sacred significance, and they are mentioned in ancient texts " + "and scriptures.\\nToday, camels continue to serve as important assets in many regions, " + "particularly in parts of Africa and the Middle East. Modern transportation methods have " + "reduced their role in trade, but they remain essential for desert travel and are a source " + "of livelihood for numerous communities.\\nThe history of the camel is a testament to the " + "remarkable coexistence of humans and animals in some of the world's most challenging environments. " + "Their story reflects the enduring bond between humans and these extraordinary creatures, " + "which have shaped the course of history in their own distinctive way.", + "title": "The Remarkable History of the Camel" + }, + } + ], + "isDiagnostic": True, + "minTimer": 60, + "type": "academic" +} + # Falta section 3 e 4 do listening # writing task 1 com imagens ... # speaking 3 é discussao lol @@ -2125,8 +2597,6 @@ db = firestore.client() # JSON data to insert # Add the JSON data to Firestore -collection_ref = db.collection('listening') -document_ref = collection_ref.add(listening_section_2_to_insert_4) +collection_ref = db.collection('reading') +document_ref = collection_ref.add(reading_to_insert_1) print(f"Document added with ID: {document_ref}") -document_ref = collection_ref.add(listening_section_2_to_insert_5) -print(f"Document added with ID: {document_ref}") \ No newline at end of file diff --git a/generate_speaking_questions.py b/generate_speaking_questions.py index 617f593..8e5ff13 100644 --- a/generate_speaking_questions.py +++ b/generate_speaking_questions.py @@ -8,6 +8,8 @@ from firebase_admin import credentials, firestore from dotenv import load_dotenv +from heygen.AvatarEnum import AvatarEnum + load_dotenv() # Initialize Firebase Admin SDK @@ -61,17 +63,15 @@ FIREBASE_SPEAKING_VIDEO_FILES_PATH = 'speaking_videos/' # 5 questions_json = { - "topic": "Health and Lifestyle", + "topic": "Hobbies and Interests", "questions": [ - "What are some of the key factors that contribute to a healthy lifestyle?", - "In what ways can technology help individuals monitor and improve their health?", - "How has the concept of a 'healthy lifestyle' evolved in recent years, and what role does society play in promoting it?" + "What do you like to do in your free time? Do you have any hobbies or interests? Are there any new hobbies you would like to try in the future?", ] } questions = [] for question in questions_json["questions"]: - result = create_video(question) + result = create_video(question, AvatarEnum.MATTHEW_NOAH) if result is not None: sound_file_path = VIDEO_FILES_PATH + result firebase_file_path = FIREBASE_SPEAKING_VIDEO_FILES_PATH + result diff --git a/helper/heygen_api.py b/helper/heygen_api.py index 853807d..d0dd561 100644 --- a/helper/heygen_api.py +++ b/helper/heygen_api.py @@ -4,6 +4,8 @@ import time from dotenv import load_dotenv +from heygen.AvatarEnum import AvatarEnum + load_dotenv() # Get HeyGen token @@ -29,10 +31,10 @@ JEROME_RYAN = "ad41feb2a5c4483085525e3d8907f512" TYLER_CHRISTOPHER = "03c796f8ed274bb38f19e893bcbc6121" -def create_video(text): +def create_video(text, avatar: AvatarEnum): # POST TO CREATE VIDEO data = { - "template_id": MATTHEW_NOAH, + "template_id": avatar, "title": "video_title", "test": False, "variables": [ diff --git a/heygen/AvatarEnum.py b/heygen/AvatarEnum.py new file mode 100644 index 0000000..7b8e391 --- /dev/null +++ b/heygen/AvatarEnum.py @@ -0,0 +1,11 @@ +from enum import Enum + + +class AvatarEnum(Enum): + MATTHEW_NOAH = "11b234e504e44bfda9bc6b7aac3c8f81" + VERA_CERISE = "9bf2f27009cd403ab4ba4e22629b27bb" + EDWARD_TONY = "d3333e37952946059b45efc8482a2b6c" + TANYA_MOLLY = "07c75076b3f94df4ac658c6de72be83a" + KAYLA_ABBI = "d688099f8db9472cb4890b0561e81793" + JEROME_RYAN = "ad41feb2a5c4483085525e3d8907f512" + TYLER_CHRISTOPHER = "03c796f8ed274bb38f19e893bcbc6121" diff --git a/trigger_create_video.py b/trigger_create_video.py new file mode 100644 index 0000000..b71ed9e --- /dev/null +++ b/trigger_create_video.py @@ -0,0 +1,3 @@ +from helper.heygen_api import create_video + +create_video("How has the concept of a 'healthy lifestyle' evolved in recent years, and what role does society play in promoting it?") \ No newline at end of file diff --git a/wt2_playground.py b/wt2_playground.py deleted file mode 100644 index 65e7640..0000000 --- a/wt2_playground.py +++ /dev/null @@ -1,99 +0,0 @@ -import streamlit as st -import openai -import os -from dotenv import load_dotenv - -load_dotenv() -openai.api_key = os.getenv("OPENAI_API_KEY") - - -def generate_summarizer( - max_tokens, - temperature, - top_p, - frequency_penalty, - question_type, - question, - answer -): - res = openai.ChatCompletion.create( - model="gpt-3.5-turbo", - max_tokens=int(max_tokens), - temperature=float(temperature), - top_p=float(top_p), - frequency_penalty=float(frequency_penalty), - messages=[ - { - "role": "user", - "content": "You are a IELTS examiner.", - }, - { - "role": "user", - "content": f"The question you have to grade is of type {question_type} and is the following: {question}", - }, - { - "role": "user", - "content": "Please provide a JSON object response with the overall grade and breakdown grades, " - "formatted as follows: {'overall': 7.0, 'task_response': {'Task Achievement': 8.0, " - "'Coherence and Cohesion': 6.5, 'Lexical Resource': 7.5, 'Grammatical Range and Accuracy': " - "6.0}}", - }, - { - "role": "user", - "content": "Don't give explanations for the grades, just provide the json with the grades.", - }, - { - "role": "user", - "content": f"Evaluate this answer according to ielts grading system: {answer}", - }, - ], - ) - return res["choices"][0]["message"]["content"] - - -# Set the application title -st.title("GPT-3.5 IELTS Examiner") - -# qt_col, q_col = st.columns(2) - -# Selection box to select the question type -# with qt_col: -question_type = st.selectbox( - "What is the question type?", - ( - "Writing Task 2", - ), -) - -# Provide the input area for question to be answered -# with q_col: -question = st.text_area("Enter the question:", height=100) - -# Provide the input area for text to be summarized -answer = st.text_area("Enter the answer:", height=100) - -# Initiate two columns for section to be side-by-side -# col1, col2 = st.columns(2) - -# Slider to control the model hyperparameter -# with col1: -token = st.slider("Token", min_value=0.0, - max_value=2000.0, value=1000.0, step=1.0) -temp = st.slider("Temperature", min_value=0.0, - max_value=1.0, value=0.7, step=0.01) -top_p = st.slider("Top_p", min_value=0.0, max_value=1.0, value=0.9, step=0.01) -f_pen = st.slider("Frequency Penalty", min_value=-1.0, - max_value=1.0, value=0.5, step=0.01) - -# Showing the current parameter used for the model -# with col2: -with st.expander("Current Parameter"): - st.write("Current Token :", token) - st.write("Current Temperature :", temp) - st.write("Current Nucleus Sampling :", top_p) - st.write("Current Frequency Penalty :", f_pen) - -# Creating button for execute the text summarization -if st.button("Grade"): - st.write(generate_summarizer(token, temp, top_p, - f_pen, question_type, question, answer))