diff --git a/.gitattributes b/.gitattributes index 1a086ccce8473abaff11b98bcaa3a7cc57ca7380..75ba3062ff78872f0d1a46183fc1ddb40587f5e7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -34,3 +34,74 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text *tfevents* filter=lfs diff=lfs merge=lfs -text llama-2-7b-chat.Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text +src/assets/flower_tech.png filter=lfs diff=lfs merge=lfs -text +src/assets/flower.jpg filter=lfs diff=lfs merge=lfs -text +src/assets/flower2.jpg filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_0.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_1.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_10.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_11.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_12.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_13.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_14.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_15.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_16.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_17.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_18.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_19.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_2.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_20.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_21.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_22.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_23.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_24.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_25.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_26.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_27.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_28.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_29.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_3.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_30.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_31.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_32.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_33.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_34.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_35.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_36.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_37.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_38.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_39.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_4.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_40.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_41.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_42.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_43.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_44.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_45.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_46.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_47.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_48.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_49.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_5.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_50.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_51.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_52.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_53.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_54.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_55.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_56.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_57.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_58.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_59.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_6.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_60.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_61.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_62.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_63.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_64.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_65.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_66.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_67.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_7.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_8.png filter=lfs diff=lfs merge=lfs -text +src/assets/plant_images/plant_9.png filter=lfs diff=lfs merge=lfs -text diff --git a/EXAMPLEvars.env b/EXAMPLEvars.env new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..1ff1a87679ef965e404d8af2ae69b2002e2b8322 --- /dev/null +++ b/LICENSE @@ -0,0 +1,28 @@ +BSD 3-Clause License + +Copyright (c) 2023, Danielle Heymann + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/app.py b/app.py new file mode 100644 index 0000000000000000000000000000000000000000..5714488986b2d49c4fbf5942272f8a9a6ce20ce2 --- /dev/null +++ b/app.py @@ -0,0 +1,384 @@ +# import libraries +import pandas as pd +import numpy as np +import os +import time +import math +import streamlit as st +#from streamlit_chat import message +from streamlit_extras.colored_header import colored_header +from streamlit_extras.add_vertical_space import add_vertical_space +from PIL import Image + +# import modules +from src.backend.chatbot import * +from src.backend.optimization_algo import * +from src.frontend.visualizations import * + + +# import compatibilities matrix +# make plant_compatibility.csv into a matrix. it currently has indexes as rows and columns for plant names and then compatibility values as the values +st.session_state.raw_plant_compatibility = pd.read_csv('src/data/plant_compatibility.csv', index_col=0) +# fill NaN values with 0 +st.session_state.raw_plant_compatibility = st.session_state.raw_plant_compatibility.fillna(0) +# get list of plants +st.session_state.plant_list = st.session_state.raw_plant_compatibility.index.tolist() + + + +# setup keys and api info +OPENAI_API_KEY = st.secrets["OPENAI_API_KEY"] +os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY + + + +#chat = ChatOpenAI() + + +# UI page config +st.set_page_config( + #page_title="GRDN.AI", + page_icon="🌱", + layout="wide", + initial_sidebar_state="expanded", +) + +# Function to display chat message with an icon +def chat_message(message, is_user=False): + if is_user: + icon = Image.open("src/assets/cool.png") + side = "left" + else: + icon = Image.open("src/assets/bot.png") + side = "right" + + chat_container = st.container() + + with chat_container: + col1, col2, col3, col4= st.columns([1,7,7,1]) + + with col1: + if is_user == True: + st.image(icon, width=50) + + with col2: + if is_user == True: + st.markdown(f'
{message}
', unsafe_allow_html=True) + with col3: + if is_user == False: + st.markdown(f'
{message}
', unsafe_allow_html=True) + with col4: + if is_user == False: + st.image(icon, width=50) + + + + +st.image ("src/assets/logo_title_transparent.png", caption=None, use_column_width=None, clamp=False, channels='RGB', output_format='auto') + +st.write("AI and optimization powered companion gardening") +colored_header(label='', description='', color_name='green-30') + +# Sidebar +# st.sidebar.title("Navigation") +# page = st.sidebar.radio("Select a page:", ("Home", "Companion Gardening", "Optimization", "About")) + +# add vertical space +with st.sidebar: + add_vertical_space(2) +# Sidebar +st.sidebar.title("Navigation") + +# Define the page options +pages = ["Garden Optimization", "About"] + +# Render the selected page content +page = st.sidebar.selectbox("Select a page:", pages) + + +if page == "Garden Optimization": + st.sidebar.subheader("Companion Gardening") + st.write("GRDN is a companion gardening app that helps you plan your garden and maximize your harvest. It uses AI to predict the best plants to grow together and optimization algorithms to optimize how you build your garden.") + st.write("This app is currently in beta. Please report any bugs.") + companion_planting_info = """ + Key Benefits + - **Pest control:** + - **Improved pollination:** + - **Maximized space:** + - **Nutrient enhancement:** + - **Complementary growth:** + + """ + + st.sidebar.markdown(companion_planting_info) + # Set the initial value of user_name + if 'user_name' not in st.session_state: + st.session_state.user_name = '' + # add in some vertical space + add_vertical_space(3) + # Display the welcome message + st.title('Let\'s get started! Decide on your garden parameters') + + + # add in some vertical space + add_vertical_space(2) + + # make a container for this section + container1 = st.container(border=True) + + with container1: + # Modify the user_name variable based on user input + if st.session_state['user_name'] == '': + col1, col2, col3= st.columns([1,2,1]) + with col1: + st.session_state['user_name_input'] = st.text_input('Enter your name', st.session_state.user_name) + if 'user_name_input' in st.session_state: + st.session_state.user_name = st.session_state.user_name_input + if st.session_state.user_name != '': + st.write('Hello ' + st.session_state['user_name'] + '! Let\'s optimize your garden. 🌱') + + # # add in some vertical space + add_vertical_space(2) + + print("") + print("____________________") + print("start of session") + + col1a, col2a= st.columns([1,2]) + enable_max_species = False + enable_min_species = False + + + # make a form to get the plant list from the user + with col1a: + with st.form(key = "plant_list_form"): + input_plants_raw = st.multiselect('plants', st.session_state.plant_list) + submit_button = st.form_submit_button(label='Submit Plant List') + if submit_button: + st.session_state['input_plants_raw'] = input_plants_raw + st.session_state.submitted_plant_list = True + + # add in some vertical space + add_vertical_space(1) + + with col2a: + col1, col2, col3= st.columns([1,1,1]) + if 'input_plants_raw' in st.session_state: + print("BP1") + # first question is what plants would you like to plant + plants_response = st.session_state.input_plants_raw + + # Initialize session state variables if they don't exist + if 'n_plant_beds' not in st.session_state: + st.session_state['n_plant_beds'] = 1 + + if 'min_species' not in st.session_state: + st.session_state['min_species'] = 1 + + if 'max_species' not in st.session_state: + st.session_state['max_species'] = 2 + + # Number of plant beds input + with col1: + n_plant_beds = st.number_input('Number of plant beds \n', min_value=1, max_value=20, value=st.session_state.n_plant_beds, step=1) + st.session_state.n_plant_beds = n_plant_beds + with col2: + # Minimum species per plant bed input + min_species = st.number_input('Minimum number of species per plant bed', + min_value=1, + max_value=len(st.session_state.input_plants_raw), + value=st.session_state.min_species, + step=1) + st.session_state.min_species = min_species + + # Maximum species per plant bed input + # It will be enabled only if min_species is set + enable_max_species = st.session_state.min_species > 0 + with col3: + max_species = st.number_input('Maximum number of species per plant bed', + min_value=st.session_state.min_species, + max_value=len(st.session_state.input_plants_raw), + value=max(st.session_state.min_species, st.session_state.max_species), + step=1, + disabled=not enable_max_species) + if enable_max_species: + st.session_state.max_species = max_species + + # extract the compatibility matrix from the user's input + if 'extracted_mat' not in st.session_state: + valid = False + if 'submitted_plant_list' in st.session_state and st.session_state.submitted_plant_list: + # check if the user's input is valid + # min species per bed must be less than or equal to max species per bed + if (st.session_state.min_species <= st.session_state.max_species + ) and ( + # max species per bed must be less than or equal to the number of plants + st.session_state.max_species <= len(st.session_state.input_plants_raw) + ) and ( + # max species per bed must be greater than or equal to the min species per bed + st.session_state.max_species >= st.session_state.min_species + ) and ( + # min species per bed must be less than or equal to the number of plants + st.session_state.min_species <= len(st.session_state.input_plants_raw) + ) and ( + # number of plant beds multiplied by min species per bed must be less than or equal to the number of plants + len(st.session_state.input_plants_raw) >= st.session_state.n_plant_beds * st.session_state.min_species + ) and ( + # number of plant beds multiplied by max species per bed must be greater than or equal to the number of plants + len(st.session_state.input_plants_raw) <= st.session_state.n_plant_beds * st.session_state.max_species + ): + valid = True + else: + # add a warning message + st.warning('Please enter valid parameters. The minimum number of species per plant bed must be less than or equal to the maximum number of species per plant bed. The maximum number of species per plant bed must be less than or equal to the number of plants. The maximum number of species per plant bed must be greater than or equal to the minimum number of species per plant bed. The minimum number of species per plant bed must be less than or equal to the number of plants. The number of plant beds multiplied by the minimum number of species per plant bed must be less than or equal to the number of plants. The number of plant beds multiplied by the maximum number of species per plant bed must be greater than or equal to the number of plants.') + + if valid: + # add in some vertical space + add_vertical_space(2) + if st.button('Generate Companion Plant Compatibility Matrix'): + with st.spinner('generating companion plant compatibility matrix...'): + st.session_state['generating_mat'] = True + # now get compatibility matrix for companion planting + time.sleep(1) + extracted_mat, full_mat, plant_index_mapping= get_compatibility_matrix_2(st.session_state.input_plants_raw) + print(extracted_mat) + st.session_state.extracted_mat = extracted_mat + st.session_state.full_mat = full_mat + st.session_state.plant_index_mapping = plant_index_mapping + # add in some vertical space + add_vertical_space(4) + + # display the companion plant compatibility matrix + if 'extracted_mat' in st.session_state: + # add a title for the next section- companion plant compatibility matrix based on user input + st.title('Your companion plant compatibility matrix') + # make a container for this section + container2 = st.container(border=True) + with container2: + col1, col2 = st.columns([8,4]) + # display the companion plant compatibility matrix + with col2: + st.write("Here is your companion plant compatibility matrix:") + with st.expander("Show ugly compatibility matrix of 1's 0's and -1's"): + st.write(st.session_state.extracted_mat) + with col1: + st.write("Here is a network visualization of your companion plant compatibility matrix. It is color coded to show which plants are companions (green), antagonists (violetred), or neutral (grey).") + plot_compatibility_with_agraph(st.session_state.input_plants_raw, st.session_state.full_mat) + st.session_state['got_mat'] = True + + if 'got_mat' in st.session_state: + # add in some vertical space + add_vertical_space(4) + # make a container for this section + container3 = st.container(border=True) + with container3: + st.title('Optimizing companion planting with the genetic algorithm and AI') + st.write("Now that we have your companion plant compatibility matrix, we can use optimization to maximize your harvest. We will use a genetic algorithm to determine the best way to plant your garden. The genetic algorithm will determine the best way to plant your garden by maximizing the number of companion plants and minimizing the number of antagonists.") + st.write("Set the parameters for the genetic algorithm. Here is more info for your reference:") + with st.form(key = "genetic_algorithm_form"): + col1, col2= st.columns([1,1]) + with col2: + with st.expander("Show more information about the genetic algorithm parameters"): + st.subheader("Plant Optimization Heuristic Performance") + st.write("The genetic algorithm parameters impact the performance of the plant optimization heuristic in the following ways:") + st.markdown("- **Population Size**: A larger population size allows for a more diverse exploration of the solution space. However, it also increases computational complexity.") + st.markdown("- **Number of Generations**: Increasing the number of generations provides more opportunities for the algorithm to converge towards an optimal solution.") + st.markdown("- **Tournament Size**: A larger tournament size promotes stronger selection pressure and can lead to faster convergence, but it may also increase the risk of premature convergence.") + st.markdown("- **Crossover Rate**: A higher crossover rate increases the exploration capability by creating diverse offspring, potentially improving the algorithm's ability to escape local optima.") + st.markdown("- **Mutation Rate**: Mutation introduces random changes in individuals, helping to maintain diversity in the population and preventing premature convergence.") + # seed population rate + st.markdown("- **Seed Population Rate**: The seed population rate is the percentage of the population that is generated based on the LLM's interpretation of compatibility. The remaining percentage of the population is generated randomly. A higher seed population rate increases the likelihood that the genetic algorithm will converge towards a solution that is compatible.") + # Run the Genetic Algorithm + with col1: + st.subheader("Genetic Algorithm Parameters") + st.write("These parameters control the behavior of the genetic algorithm.") + + # Genetic Algorithm parameters + st.session_state.population_size = st.slider("Population Size", min_value=400, max_value=1000, value=500, + help="The number of individuals in each generation of the genetic algorithm.") + st.session_state.num_generations = st.slider("Number of Generations", min_value=400, max_value=1000, value=450, + help="The total number of generations to evolve through.") + st.session_state.tournament_size = st.slider("Tournament Size", min_value=5, max_value=20, value=10, + help="The number of individuals competing in each tournament selection round.") + st.session_state.crossover_rate = st.slider("Crossover Rate", min_value=0.1, max_value=1.0, step=0.1, value=0.8, + help="The probability of two individuals undergoing crossover to create offspring.") + st.session_state.mutation_rate = st.slider("Mutation Rate", min_value=0.01, max_value=0.9, step=0.01, value=0.3, + help="The probability of an individual undergoing mutation.") + st.session_state.seed_population_rate = st.slider("Seed Population Rate", min_value=0.0, max_value=.02, step=0.001, value=0.08, + help="The percentage of the population that is generated based on the LLM's interpretation of compatibility. The remaining percentage of the population is generated randomly.") + + # + # Run the genetic algorithm + if st.form_submit_button(label='Run Genetic Algorithm'): + with st.spinner('running genetic algorithm... this may take a minute'): + grouping = genetic_algorithm_plants() + st.session_state.grouping = grouping + + # visualize the groupings + # add in some vertical space + add_vertical_space(4) + # make a container for this section + st.title(st.session_state.user_name + "'s optimized garden") + st.header("Here are the optimized groupings of plants for your garden") + container4 = st.container(border=True) + with container4: + if 'grouping' in st.session_state: + visualize_groupings() + if 'best_fitness' in st.session_state: + # embed score.png + col1b, col2b = st.columns([2,11]) + with col1b: + st.image("src/assets/score.png", caption=None, width = 160, use_column_width=None, clamp=False, channels='RGB', output_format='auto') + with col2b: + #st.write("\n") + st.header("| " + str(st.session_state.best_fitness)) + st.write("The genetic algorithm converged towards a solution with a fitness score of " + str(st.session_state.best_fitness) + ".") + # Add vertical space + add_vertical_space(4) + # show plant care tips + st.header("Plant care tips") + with st.spinner('generating plant care tips...'): + st.write("Here are some plant care tips for your plants. Good luck!") + #if 'plant_care_tips' not in st.session_state: + st.session_state.plant_care_tips = get_plant_care_tips(st.session_state.input_plants_raw) + styled_text = f'
{st.session_state.plant_care_tips}
' + st.write(styled_text, unsafe_allow_html=True) + + + + + + +if page == "About": + st.sidebar.subheader("About") + st.sidebar.write("GRDN is a companion gardening app that helps you plan your garden and maximize your harvest. It uses AI to predict the best plants to grow together and optimization algorithms to optimize how you build your garden.") + st.sidebar.write("Companion gardening is the practice of planting different plants together to maximize their growth. Companion gardening can help to increase the yield of your garden, improve the health of your plants, and reduce the need for pesticides.") + st.write("This app is currently in beta. Please report any bugs to the team.") + + col1, col2= st.columns([1,1]) + with col1: + st.subheader("Contact Information") + st.write("Author: Danielle Heymann") + st.write("Email: dheymann314@gmail.com") + st.write("LinkedIn: https://www.linkedin.com/in/danielle-heymann/") + with col2: + st.subheader("Software, data, and libraries used") + st.write("Libraries and Software") + st.markdown(""" + - Python + - streamlit + - openai + - plotly + - pandas + - numpy + - PIL + - langchain + - streamlit_chat + - github copilot + - chatGPT + - GPT family of models + - DALL·E 3 (in preprocessing script for image generation) + """) + st.write("Data sources in addition to what GPT was trained on: \n https://waldenlabs.com/the-ultimate-companion-planting-guide-chart/ ") + + st.write("avatars from: https://www.flaticon.com/free-icons/bot") diff --git a/notebooks/.ipynb_checkpoints/langchain experimenting-checkpoint.ipynb b/notebooks/.ipynb_checkpoints/langchain experimenting-checkpoint.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..926ed0a362e3b97c2bd1b969eacf75aa416825cc --- /dev/null +++ b/notebooks/.ipynb_checkpoints/langchain experimenting-checkpoint.ipynb @@ -0,0 +1,843 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "import langchain\n", + "from langchain import PromptTemplate, LLMChain" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# huggingface" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from langchain import HuggingFacePipeline\n", + "\n", + "llm = HuggingFacePipeline.from_model_id(\n", + " model_id=\"bigscience/bloom-560m\",\n", + " task=\"text-generation\",\n", + " model_kwargs={\"temperature\": 0, \"max_length\": 64},\n", + ")\n", + "\n", + "\n", + "# Integrate the model in an LLMChain\n", + "from langchain import PromptTemplate, LLMChain\n", + "\n", + "template = \"\"\"Question: {question}\n", + "\n", + "Answer: Let's think step by step.\"\"\"\n", + "prompt = PromptTemplate(template=template, input_variables=[\"question\"])\n", + "\n", + "llm_chain = LLMChain(prompt=prompt, llm=llm)\n", + "\n", + "question = \"What is electroencephalography?\"\n", + "\n", + "print(llm_chain.run(question))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# galactica" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import galai as gal\n", + "\n", + "model = gal.load_model(\"standard\")\n", + "# model.generate(\"Scaled dot product attention:\\n\\n\\\\[\")\n", + "# Scaled dot product attention:\\n\\n\\\\[ \\\\displaystyle\\\\text{Attention}(Q,K,V)=\\\\text{softmax}(\\\\frac{QK^{T}}{\\\\sqrt{d_{k}}}%\\n)V \\\\]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "model.generate(\"from this list, [vodka, strawberries, corn, peas],create a new python list that ONLY includes produce \")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "TEXT = \"vodka, strawberries, corn, peas, cherries, sodapop\"\n", + "model.generate( '\\n\\nQuestion: Of the items in this list, \\n\\n vodka, strawberries, corn, peas, cherries, diet coke, \\n\\n which can grow in a garden?\\n\\nAnswer:')\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "model.generate(\"a plant compatability matrix is a a python matrix and will have a score of -1 for negative relationship between plants, 0 for neutral relationship between plants, and 1 for a positive relationship between plants. create a python array of plant compatibility between the plants listed: \" + str(plant_list))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# openai + langchain" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# plant compatiblity context source: https://waldenlabs.com/the-ultimate-companion-planting-guide-chart/" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "from langchain.chat_models import ChatOpenAI\n", + "\n", + "file_path = 'C:/Users/dheym/OneDrive/Documents/api_keys/openai_api_keys.txt'\n", + "with open(file_path, 'r') as file:\n", + " OPENAI_API_KEY = file.read()\n", + "\n", + "os.environ[\"OPENAI_API_KEY\"] = OPENAI_API_KEY\n", + "#If you'd prefer not to set an environment variable you can pass the key in directly via the openai_api_key named parameter when initiating the OpenAI LLM class:\n", + "\n", + "\n", + "chat = ChatOpenAI()\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def parse_and_evaluate_text(text):\n", + " # Find the indices of the opening and closing brackets\n", + " opening_bracket_index = text.find(\"[\")\n", + " closing_bracket_index = text.find(\"]\")\n", + "\n", + " if opening_bracket_index != -1 and closing_bracket_index != -1:\n", + " # Extract the text within the brackets\n", + " extracted_list = \"[\" + text[opening_bracket_index + 1: closing_bracket_index] + \"]\"\n", + " # Return the evaluated text list\n", + " return eval(extracted_list)\n", + " \n", + "\n", + " else:\n", + " print(\"Error with parsing plant list\")\n", + " return None" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from langchain.prompts.chat import (\n", + " ChatPromptTemplate,\n", + " SystemMessagePromptTemplate,\n", + " AIMessagePromptTemplate,\n", + " HumanMessagePromptTemplate,\n", + ")\n", + "\n", + "\n", + "def parse_and_evaluate_text(text):\n", + " # Find the indices of the opening and closing brackets\n", + " opening_bracket_index = text.find(\"[\")\n", + " closing_bracket_index = text.find(\"]\")\n", + "\n", + " if opening_bracket_index != -1 and closing_bracket_index != -1:\n", + " # Extract the text within the brackets\n", + " extracted_list = \"[\" + text[opening_bracket_index + 1: closing_bracket_index] + \"]\"\n", + " # Return the evaluated text list\n", + " return eval(extracted_list)\n", + " \n", + "\n", + " else:\n", + " print(\"Error with parsing plant list\")\n", + " return None\n", + " \n", + "def chat_response(template, prompt_text):\n", + " system_message_prompt = SystemMessagePromptTemplate.from_template(template)\n", + " human_template=\"{text}\"\n", + " human_message_prompt = HumanMessagePromptTemplate.from_template(human_template)\n", + " chat_prompt = ChatPromptTemplate.from_messages([system_message_prompt, human_message_prompt])\n", + " response = chat(chat_prompt.format_prompt(text= prompt_text).to_messages())\n", + " return response\n", + "\n", + "# get the plant list from user input\n", + "def get_plant_list(input_plant_text):\n", + " template=\"You are a helpful assistant that knows all about gardening and plants and python data structures.\"\n", + " text = 'which of the elements of this list can be grown in a garden, [' + input_plant_text + ']? Return JUST a python list object containing the elements that can be grown in a garden. Do not include any other text or explanation.'\n", + " plant_list_text = chat_response(template, text)\n", + " plant_list = parse_and_evaluate_text(plant_list_text.content)\n", + " print(plant_list)\n", + " return plant_list\n", + "\n", + "# get compatability matrix for companion planting\n", + "def get_compatibility_matrix(plant_list):\n", + " # Convert the compatibility matrix to a string\n", + " with open('compatibilities_text.txt', 'r') as file:\n", + " # Read the contents of the file\n", + " compatibility_text = file.read()\n", + " plant_comp_context = compatibility_text\n", + " template=\"You are a helpful assistant that knows all about gardening, companion planting, and python data structures- specifically compatibility matrices.\"\n", + " text = 'from this list of plants, [' + str(plant_list) + '], Return JUST a python array (with values separated by commas like this: [[0,1],[1,0]]\\n\\n ) for companion plant compatibility. Each row and column should represent plants, and the element of the array will contain a -1, 0, or 1 depending on if the relationship between plants is antagonists, neutral, or companions, respectively. You must refer to this knowledge base of information on plant compatibility: \\n\\n, ' + plant_comp_context + '\\n\\n A plant\\'s compatibility with itself is always 0. Do not include any other text or explanation.'\n", + " compatibility_mat = chat_response(template, text)\n", + " \n", + " # Find the indices of the opening and closing brackets\n", + " opening_bracket_index = compatibility_mat.content.find(\"[[\")\n", + " closing_bracket_index = compatibility_mat.content.find(\"]]\")\n", + " if opening_bracket_index != -1 and closing_bracket_index != -1:\n", + " # Extract the text within the brackets\n", + " extracted_mat = \"[\" + compatibility_mat.content[opening_bracket_index + 1: closing_bracket_index] + \"]]\"\n", + " # Return the evaluated mat\n", + " return eval(extracted_mat)\n", + " else:\n", + " print(\"Error with parsing plant compatibility matrix\")\n", + " return None\n", + " return \n", + "\n", + "\n", + "input_plant_text = \"strawberries, mint, pepper, diet coke, carrots, lettuce, vodka, basil, tomatoes, marigolds, lemons, spinach, brocoli\"\n", + "input_plant_text = \"apples, basil, bean, rue, oregano, onion\"\n", + "plant_list = get_plant_list(input_plant_text)\n", + "extracted_mat = get_compatibility_matrix(plant_list)\n", + "print(extracted_mat)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## langchain additional context and fine tuning" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# process the plant compatibility matrix to a json\n", + "import csv\n", + "import json\n", + "\n", + "# Open the CSV file\n", + "with open('plant_compatability.csv', 'r') as file:\n", + " reader = csv.reader(file)\n", + " \n", + " # Read the header row to get the plant names\n", + " header = next(reader)\n", + " \n", + " # Create an empty dictionary to store the compatibility matrix\n", + " compatibility_matrix = {}\n", + " \n", + " # Iterate over the rows in the CSV file\n", + " for row in reader:\n", + " # Extract the plant name from the first column\n", + " plant = row[0]\n", + " \n", + " # Create a dictionary to store the compatibility values for the current plant\n", + " compatibility_values = {}\n", + " \n", + " # Iterate over the compatibility values in the row\n", + " for i, value in enumerate(row[1:], start=1):\n", + " # Extract the plant name from the header row\n", + " companion_plant = header[i]\n", + " \n", + " # Convert the compatibility value to an integer\n", + " compatibility = int(value) if value else 0\n", + " \n", + " # Add the compatibility value to the dictionary\n", + " compatibility_values[companion_plant] = compatibility\n", + " \n", + " # Add the compatibility values dictionary to the main compatibility matrix\n", + " compatibility_matrix[plant] = compatibility_values\n", + "\n", + "# Save the compatibility matrix as a JSON file\n", + "with open('compatibility_matrix.json', 'w') as file:\n", + " json.dump(compatibility_matrix, file, indent=4)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import openai\n", + "\n", + "# Load the compatibility matrix from the JSON file\n", + "with open('compatibility_matrix.json', 'r') as file:\n", + " compatibility_matrix = json.load(file)\n", + "\n", + "# Convert the compatibility matrix to a string\n", + "compatibility_matrix_text = json.dumps(compatibility_matrix)\n", + "with open('compatibilities_text.txt', 'r') as file:\n", + " # Read the contents of the file\n", + " compatibility_matrix_text = file.read()\n", + "\n", + "# Set up the LangChain API credentials\n", + "openai.api_key = OPENAI_API_KEY\n", + "\n", + "# Define the prompt for the GPT model\n", + "prompt = \"Can you provide companion plant suggestions for my garden given what you know about companion planting?\"\n", + "\n", + "# Concatenate the prompt and compatibility matrix text as the input to the GPT model\n", + "input_text = f\"{prompt}\\n\\n{compatibility_matrix_text}\"\n", + "\n", + "# Generate a response from the GPT model\n", + "response = openai.Completion.create(\n", + " engine='text-davinci-003',\n", + " prompt=input_text,\n", + " max_tokens=575\n", + ")\n", + "\n", + "print(response.choices[0])\n", + "# Extract the generated companion plant suggestions from the response\n", + "suggestions = response.choices[0].text.strip()\n", + "\n", + "# Print the companion plant suggestions\n", + "print(suggestions)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from langchain.client import Client\n", + "\n", + "# Load the fine-tuned GPT model\n", + "model = OpenAI(openai_api_key=OPENAI_API_KEY)\n", + "\n", + "# Load the knowledge base or context from websites or documents\n", + "knowledge_base = YourProcessedData()\n", + "\n", + "# Initialize the Langchain client\n", + "client = Client()\n", + "\n", + "# Set the context for the GPT model\n", + "context = \"Context from websites or documents\"\n", + "model.set_context(context)\n", + "\n", + "# Get companion plant compatibility predictions\n", + "plants = ['strawberries', 'mint', 'carrots', 'lettuce', 'basil']\n", + "predictions = []\n", + "\n", + "for plant in plants:\n", + " # Generate a question for each plant\n", + " question = f\"Which plants are compatible with {plant}?\"\n", + " \n", + " # Provide the question and context to the Langchain client\n", + " response = client.query(question, context=context)\n", + " \n", + " # Process and extract the answer from the response\n", + " answer = response['answer']\n", + " predictions.append((plant, answer))\n", + "\n", + "# Process and display the compatibility predictions\n", + "for plant, compatibility in predictions:\n", + " print(f\"{plant}: {compatibility}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import networkx as nx\n", + "import matplotlib.pyplot as plt\n", + "\n", + "# Define the plant list\n", + "plants = ['strawberries', 'mint', 'carrots', 'lettuce', 'basil', 'tomatoes', 'marigolds', 'lemons', 'strawberries', 'spinach', 'broccoli']\n", + "\n", + "# Define the compatibility matrix\n", + "compatibility_matrix = np.array([\n", + "[0, 1, 0, 0, 1, -1, 1, 0, 0, 0, -1],\n", + "[1, 0, 0, 0, 1, -1, 1, 0, 1, 0, -1],\n", + "[0, 0, 0, -1, 0, 1, 0, 0, 0, 1, 0],\n", + "[0, 0, -1, 0, 0, 1, 0, 0, 0, 1, 0],\n", + "[1, 1, 0, 0, 0, -1, 1, 0, 0, 0, -1],\n", + "[-1, -1, 1, 1, -1, 0, -1, 0, 0, 0, 1],\n", + "[1, 1, 0, 0, 1, -1, 0, 0, 0, 0, -1],\n", + "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n", + "[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n", + "[0, 0, 1, 1, 0, 0, 0, 0, 0, 0, -1],\n", + "[-1, -1, 0, 0, -1, 1, -1, 0, 0, -1, 0]\n", + "])\n", + "\n", + "# Create an empty graph\n", + "G = nx.Graph()\n", + "\n", + "# Add nodes (plants) to the graph\n", + "G.add_nodes_from(plants)\n", + "\n", + "# Add edges (compatibility) to the graph\n", + "for i in range(len(plants)):\n", + " for j in range(i + 1, len(plants)):\n", + " if compatibility_matrix[i][j] == 0:\n", + " color = 'grey'\n", + " elif compatibility_matrix[i][j] == -1:\n", + " color = 'pink'\n", + " else:\n", + " color = 'green'\n", + " G.add_edge(plants[i], plants[j], color=color)\n", + "\n", + "# Plot the graph\n", + "pos = nx.spring_layout(G)\n", + "colors = [G[u][v]['color'] for u, v in G.edges()]\n", + "nx.draw_networkx(G, pos, with_labels=True, node_color='lightgreen', edge_color=colors, width=2.0, alpha=0.8)\n", + "\n", + "# Set edge colors in the legend\n", + "color_legend = {'Neutral': 'grey', 'Negative': 'pink', 'Positive': 'green'}\n", + "legend_lines = [plt.Line2D([0], [0], color=color, linewidth=3) for color in color_legend.values()]\n", + "legend_labels = list(color_legend.keys())\n", + "plt.legend(legend_lines, legend_labels, loc='best')\n", + "\n", + "# Show the plot\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import streamlit as st\n", + "import networkx as nx\n", + "import plotly.graph_objects as go\n", + "\n", + "# Define the plants and compatibility matrix\n", + "plants = ['strawberries', 'mint', 'carrots', 'lettuce', 'basil', 'tomatoes', 'marigolds', 'lemons', 'strawberries', 'spinach', 'broccoli']\n", + "compatibility_matrix = [\n", + " [0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1],\n", + " [1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1],\n", + " [0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1],\n", + " [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1],\n", + " [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1],\n", + " [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n", + " [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1],\n", + " [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n", + " [0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1],\n", + " [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1],\n", + " [1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0]\n", + "]\n", + "\n", + "# Create a directed graph\n", + "G = nx.DiGraph()\n", + "\n", + "# Add nodes to the graph\n", + "G.add_nodes_from(plants)\n", + "\n", + "# Define positions for the nodes\n", + "pos = nx.spring_layout(G)\n", + "\n", + "# Assign positions to the nodes\n", + "for node, position in pos.items():\n", + " G.nodes[node]['pos'] = position\n", + "\n", + "# Iterate over the compatibility matrix and add edges with corresponding colors\n", + "for i in range(len(plants)):\n", + " for j in range(len(plants)):\n", + " if compatibility_matrix[i][j] == -1:\n", + " G.add_edge(plants[i], plants[j], color='red')\n", + " elif compatibility_matrix[i][j] == 1:\n", + " G.add_edge(plants[i], plants[j], color='green')\n", + " else:\n", + " G.add_edge(plants[i], plants[j], color='lightgray')\n", + "\n", + "# Create edge traces\n", + "# Create edge traces\n", + "edge_traces = []\n", + "for edge in G.edges():\n", + " x0, y0 = G.nodes[edge[0]]['pos']\n", + " x1, y1 = G.nodes[edge[1]]['pos']\n", + " color = G.edges[edge]['color']\n", + " trace = go.Scatter(x=[x0, x1, None], y=[y0, y1, None], mode='lines', line=dict(color=color, width=2))\n", + " edge_traces.append(trace)\n", + "\n", + "# Create node traces\n", + "node_traces = []\n", + "for node in G.nodes():\n", + " x, y = G.nodes[node]['pos']\n", + " trace = go.Scatter(x=[x], y=[y], mode='markers', marker=dict(color='black', size=10), name=node)\n", + " node_traces.append(trace)\n", + "\n", + "# Create figure\n", + "fig = go.Figure(data=edge_traces + node_traces)\n", + "\n", + "# Set layout options\n", + "fig.update_layout(\n", + " title='Plant Network',\n", + " showlegend=False,\n", + " hovermode='closest',\n", + " margin=dict(b=20, l=5, r=5, t=40),\n", + " xaxis=dict(showgrid=False, zeroline=False, showticklabels=False),\n", + " yaxis=dict(showgrid=False, zeroline=False, showticklabels=False)\n", + ")\n", + "\n", + "# Render the graph\n", + "#st.plotly_chart(fig)\n", + "fig" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import streamlit as st\n", + "import networkx as nx\n", + "import plotly.graph_objects as go\n", + "\n", + "# Define the plants and compatibility matrix\n", + "plants = ['strawberries', 'mint', 'carrots', 'lettuce', 'basil', 'tomatoes', 'marigolds', 'lemons', 'strawberries', 'spinach', 'broccoli']\n", + "compatibility_matrix = [\n", + " [0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1],\n", + " [1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1],\n", + " [0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1],\n", + " [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1],\n", + " [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1],\n", + " [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n", + " [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1],\n", + " [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n", + " [0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1],\n", + " [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1],\n", + " [1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0]\n", + "]\n", + "\n", + "# Create the graph\n", + "G = nx.Graph()\n", + "G.add_nodes_from(plants)\n", + "for i in range(len(plants)):\n", + " for j in range(i + 1, len(plants)):\n", + " if compatibility_matrix[i][j] == 0:\n", + " G.add_edge(plants[i], plants[j], color='lightgrey')\n", + " else:\n", + " G.add_edge(plants[i], plants[j], color='green' if compatibility_matrix[i][j] == 1 else 'pink')\n", + "\n", + "# Generate positions for the nodes\n", + "pos = nx.spring_layout(G)\n", + "\n", + "# Create node trace\n", + "node_trace = go.Scatter(\n", + " x=[pos[node][0] for node in G.nodes()],\n", + " y=[pos[node][1] for node in G.nodes()],\n", + " text=list(G.nodes()),\n", + " mode='markers+text',\n", + " textposition='top center',\n", + " hoverinfo='text',\n", + " marker=dict(\n", + " size=20,\n", + " color='lightblue',\n", + " line_width=2,\n", + " )\n", + ")\n", + "\n", + "# Create edge trace\n", + "edge_trace = go.Scatter(\n", + " x=[],\n", + " y=[],\n", + " line=dict(width=1, color='lightgrey'),\n", + " hoverinfo='none',\n", + " mode='lines'\n", + ")\n", + "\n", + "# Add coordinates to edge trace\n", + "for edge in G.edges():\n", + " x0, y0 = pos[edge[0]]\n", + " x1, y1 = pos[edge[1]]\n", + " edge_trace['x'] += tuple([x0, x1, None])\n", + " edge_trace['y'] += tuple([y0, y1, None])\n", + "\n", + "# Create edge traces for colored edges\n", + "edge_traces = []\n", + "for edge in G.edges(data=True):\n", + " x0, y0 = pos[edge[0]]\n", + " x1, y1 = pos[edge[1]]\n", + " color = edge[2]['color']\n", + " trace = go.Scatter(\n", + " x=[x0, x1],\n", + " y=[y0, y1],\n", + " mode='lines',\n", + " line=dict(width=2, color=color),\n", + " hoverinfo='none'\n", + " )\n", + " edge_traces.append(trace)\n", + "\n", + "# Create layout\n", + "layout = go.Layout(\n", + " title='Plant Compatibility Network Graph',\n", + " showlegend=False,\n", + " hovermode='closest',\n", + " margin=dict(b=20, l=5, r=5, t=40),\n", + " xaxis=dict(showgrid=False, zeroline=False, showticklabels=False),\n", + " yaxis=dict(showgrid=False, zeroline=False, showticklabels=False)\n", + ")\n", + "\n", + "# Create figure\n", + "fig = go.Figure(data=[edge_trace, *edge_traces, node_trace], layout=layout)\n", + "\n", + "# Render the graph using Plotly in Streamlit\n", + "st.plotly_chart(fig)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import random\n", + "import numpy as np\n", + "\n", + "# Define the compatibility matrix\n", + "compatibility_matrix = np.array([\n", + " [-1, 1, 0, -1],\n", + " [1, -1, 1, -1],\n", + " [1, 0, -1, 1],\n", + " [-1, -1, 1, -1]\n", + "])\n", + "\n", + "# Define the user-selected plants, number of plant beds, and constraints\n", + "user_plants = [\"A\", \"B\", \"C\", \"D\"]\n", + "num_plant_beds = 4\n", + "min_species_per_bed = 1\n", + "max_species_per_bed = 2\n", + "\n", + "# Genetic Algorithm parameters\n", + "population_size = 50\n", + "num_generations = 100\n", + "tournament_size = 3\n", + "crossover_rate = 0.8\n", + "mutation_rate = 0.1\n", + "\n", + "# Generate an initial population randomly\n", + "def generate_initial_population():\n", + " population = []\n", + " for _ in range(population_size):\n", + " grouping = []\n", + " for _ in range(num_plant_beds):\n", + " num_species = random.randint(min_species_per_bed, max_species_per_bed)\n", + " species = random.sample(user_plants, num_species)\n", + " grouping.append(species)\n", + " population.append(grouping)\n", + " return population\n", + "\n", + "# Calculate the fitness score of a grouping\n", + "def calculate_fitness(grouping):\n", + " score = 0\n", + " for bed1 in range(num_plant_beds):\n", + " for bed2 in range(bed1 + 1, num_plant_beds):\n", + " for species1 in grouping[bed1]:\n", + " for species2 in grouping[bed2]:\n", + " species1_index = user_plants.index(species1)\n", + " species2_index = user_plants.index(species2)\n", + " score += compatibility_matrix[species1_index][species2_index]\n", + " return score\n", + "\n", + "# Perform tournament selection\n", + "def tournament_selection(population):\n", + " selected = []\n", + " for _ in range(population_size):\n", + " participants = random.sample(population, tournament_size)\n", + " winner = max(participants, key=calculate_fitness)\n", + " selected.append(winner)\n", + " return selected\n", + "\n", + "# Perform crossover between two parents\n", + "def crossover(parent1, parent2):\n", + " if random.random() < crossover_rate:\n", + " crossover_point = random.randint(1, num_plant_beds - 1)\n", + " child1 = parent1[:crossover_point] + parent2[crossover_point:]\n", + " child2 = parent2[:crossover_point] + parent1[crossover_point:]\n", + " return child1, child2\n", + " else:\n", + " return parent1, parent2\n", + "\n", + "# Perform mutation on an individual\n", + "def mutate(individual):\n", + " if random.random() < mutation_rate:\n", + " mutated_bed = random.randint(0, num_plant_beds - 1)\n", + " new_species = random.sample(user_plants, random.randint(min_species_per_bed, max_species_per_bed))\n", + " individual[mutated_bed] = new_species\n", + " return individual\n", + "\n", + "# Perform replacement of the population with the offspring\n", + "def replacement(population, offspring):\n", + " sorted_population = sorted(population, key=calculate_fitness, reverse=True)\n", + " sorted_offspring = sorted(offspring, key=calculate_fitness, reverse=True)\n", + " return sorted_population[:population_size - len(offspring)] + sorted_offspring\n", + "\n", + "# Genetic Algorithm main function\n", + "def genetic_algorithm():\n", + " population = generate_initial_population()\n", + "\n", + " for generation in range(num_generations):\n", + " print(f\"Generation {generation + 1}\")\n", + "\n", + " selected_population = tournament_selection(population)\n", + " offspring = []\n", + "\n", + " for _ in range(population_size // 2):\n", + " parent1 = random.choice(selected_population)\n", + " parent2 = random.choice(selected_population)\n", + " child1, child2 = crossover(parent1, parent2)\n", + " child1 = mutate(child1)\n", + " child2 = mutate(child2)\n", + " offspring.extend([child1, child2])\n", + "\n", + " population = replacement(population, offspring)\n", + "\n", + " best_grouping = max(population, key=calculate_fitness)\n", + " best_fitness = calculate_fitness(best_grouping)\n", + " print(f\"Best Grouping: {best_grouping}\")\n", + " print(f\"Fitness Score: {best_fitness}\")\n", + "\n", + "# Run the Genetic Algorithm\n", + "genetic_algorithm()\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def query_farmersalmanac(title, first_paragraph_only=True):\n", + " base_url = \"https://www.almanac.com/companion-planting-guide-vegetables\"\n", + " url = f\"{base_url}/w/api.php?format=json&action=query&prop=extracts&explaintext=1&titles={title}\"\n", + " if first_paragraph_only:\n", + " url += \"&exintro=1\"\n", + " data = requests.get(url).json()\n", + " return Document(\n", + " metadata={\"source\": f\"{base_url}\"},\n", + " page_content=list(data[\"query\"][\"pages\"].values())[0][\"extract\"],\n", + " )" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## future with sources\n", + "- https://dzlab.github.io/2023/01/02/prompt-langchain/\n", + "- https://techcommunity.microsoft.com/t5/startups-at-microsoft/build-a-chatbot-to-query-your-documentation-using-langchain-and/ba-p/3833134" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "GRDN_env", + "language": "python", + "name": "grdn_env" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.9" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/notebooks/langchain experimenting.ipynb b/notebooks/langchain experimenting.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..926ed0a362e3b97c2bd1b969eacf75aa416825cc --- /dev/null +++ b/notebooks/langchain experimenting.ipynb @@ -0,0 +1,843 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "import langchain\n", + "from langchain import PromptTemplate, LLMChain" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# huggingface" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from langchain import HuggingFacePipeline\n", + "\n", + "llm = HuggingFacePipeline.from_model_id(\n", + " model_id=\"bigscience/bloom-560m\",\n", + " task=\"text-generation\",\n", + " model_kwargs={\"temperature\": 0, \"max_length\": 64},\n", + ")\n", + "\n", + "\n", + "# Integrate the model in an LLMChain\n", + "from langchain import PromptTemplate, LLMChain\n", + "\n", + "template = \"\"\"Question: {question}\n", + "\n", + "Answer: Let's think step by step.\"\"\"\n", + "prompt = PromptTemplate(template=template, input_variables=[\"question\"])\n", + "\n", + "llm_chain = LLMChain(prompt=prompt, llm=llm)\n", + "\n", + "question = \"What is electroencephalography?\"\n", + "\n", + "print(llm_chain.run(question))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# galactica" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import galai as gal\n", + "\n", + "model = gal.load_model(\"standard\")\n", + "# model.generate(\"Scaled dot product attention:\\n\\n\\\\[\")\n", + "# Scaled dot product attention:\\n\\n\\\\[ \\\\displaystyle\\\\text{Attention}(Q,K,V)=\\\\text{softmax}(\\\\frac{QK^{T}}{\\\\sqrt{d_{k}}}%\\n)V \\\\]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "model.generate(\"from this list, [vodka, strawberries, corn, peas],create a new python list that ONLY includes produce \")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "TEXT = \"vodka, strawberries, corn, peas, cherries, sodapop\"\n", + "model.generate( '\\n\\nQuestion: Of the items in this list, \\n\\n vodka, strawberries, corn, peas, cherries, diet coke, \\n\\n which can grow in a garden?\\n\\nAnswer:')\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "model.generate(\"a plant compatability matrix is a a python matrix and will have a score of -1 for negative relationship between plants, 0 for neutral relationship between plants, and 1 for a positive relationship between plants. create a python array of plant compatibility between the plants listed: \" + str(plant_list))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# openai + langchain" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# plant compatiblity context source: https://waldenlabs.com/the-ultimate-companion-planting-guide-chart/" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "from langchain.chat_models import ChatOpenAI\n", + "\n", + "file_path = 'C:/Users/dheym/OneDrive/Documents/api_keys/openai_api_keys.txt'\n", + "with open(file_path, 'r') as file:\n", + " OPENAI_API_KEY = file.read()\n", + "\n", + "os.environ[\"OPENAI_API_KEY\"] = OPENAI_API_KEY\n", + "#If you'd prefer not to set an environment variable you can pass the key in directly via the openai_api_key named parameter when initiating the OpenAI LLM class:\n", + "\n", + "\n", + "chat = ChatOpenAI()\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def parse_and_evaluate_text(text):\n", + " # Find the indices of the opening and closing brackets\n", + " opening_bracket_index = text.find(\"[\")\n", + " closing_bracket_index = text.find(\"]\")\n", + "\n", + " if opening_bracket_index != -1 and closing_bracket_index != -1:\n", + " # Extract the text within the brackets\n", + " extracted_list = \"[\" + text[opening_bracket_index + 1: closing_bracket_index] + \"]\"\n", + " # Return the evaluated text list\n", + " return eval(extracted_list)\n", + " \n", + "\n", + " else:\n", + " print(\"Error with parsing plant list\")\n", + " return None" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from langchain.prompts.chat import (\n", + " ChatPromptTemplate,\n", + " SystemMessagePromptTemplate,\n", + " AIMessagePromptTemplate,\n", + " HumanMessagePromptTemplate,\n", + ")\n", + "\n", + "\n", + "def parse_and_evaluate_text(text):\n", + " # Find the indices of the opening and closing brackets\n", + " opening_bracket_index = text.find(\"[\")\n", + " closing_bracket_index = text.find(\"]\")\n", + "\n", + " if opening_bracket_index != -1 and closing_bracket_index != -1:\n", + " # Extract the text within the brackets\n", + " extracted_list = \"[\" + text[opening_bracket_index + 1: closing_bracket_index] + \"]\"\n", + " # Return the evaluated text list\n", + " return eval(extracted_list)\n", + " \n", + "\n", + " else:\n", + " print(\"Error with parsing plant list\")\n", + " return None\n", + " \n", + "def chat_response(template, prompt_text):\n", + " system_message_prompt = SystemMessagePromptTemplate.from_template(template)\n", + " human_template=\"{text}\"\n", + " human_message_prompt = HumanMessagePromptTemplate.from_template(human_template)\n", + " chat_prompt = ChatPromptTemplate.from_messages([system_message_prompt, human_message_prompt])\n", + " response = chat(chat_prompt.format_prompt(text= prompt_text).to_messages())\n", + " return response\n", + "\n", + "# get the plant list from user input\n", + "def get_plant_list(input_plant_text):\n", + " template=\"You are a helpful assistant that knows all about gardening and plants and python data structures.\"\n", + " text = 'which of the elements of this list can be grown in a garden, [' + input_plant_text + ']? Return JUST a python list object containing the elements that can be grown in a garden. Do not include any other text or explanation.'\n", + " plant_list_text = chat_response(template, text)\n", + " plant_list = parse_and_evaluate_text(plant_list_text.content)\n", + " print(plant_list)\n", + " return plant_list\n", + "\n", + "# get compatability matrix for companion planting\n", + "def get_compatibility_matrix(plant_list):\n", + " # Convert the compatibility matrix to a string\n", + " with open('compatibilities_text.txt', 'r') as file:\n", + " # Read the contents of the file\n", + " compatibility_text = file.read()\n", + " plant_comp_context = compatibility_text\n", + " template=\"You are a helpful assistant that knows all about gardening, companion planting, and python data structures- specifically compatibility matrices.\"\n", + " text = 'from this list of plants, [' + str(plant_list) + '], Return JUST a python array (with values separated by commas like this: [[0,1],[1,0]]\\n\\n ) for companion plant compatibility. Each row and column should represent plants, and the element of the array will contain a -1, 0, or 1 depending on if the relationship between plants is antagonists, neutral, or companions, respectively. You must refer to this knowledge base of information on plant compatibility: \\n\\n, ' + plant_comp_context + '\\n\\n A plant\\'s compatibility with itself is always 0. Do not include any other text or explanation.'\n", + " compatibility_mat = chat_response(template, text)\n", + " \n", + " # Find the indices of the opening and closing brackets\n", + " opening_bracket_index = compatibility_mat.content.find(\"[[\")\n", + " closing_bracket_index = compatibility_mat.content.find(\"]]\")\n", + " if opening_bracket_index != -1 and closing_bracket_index != -1:\n", + " # Extract the text within the brackets\n", + " extracted_mat = \"[\" + compatibility_mat.content[opening_bracket_index + 1: closing_bracket_index] + \"]]\"\n", + " # Return the evaluated mat\n", + " return eval(extracted_mat)\n", + " else:\n", + " print(\"Error with parsing plant compatibility matrix\")\n", + " return None\n", + " return \n", + "\n", + "\n", + "input_plant_text = \"strawberries, mint, pepper, diet coke, carrots, lettuce, vodka, basil, tomatoes, marigolds, lemons, spinach, brocoli\"\n", + "input_plant_text = \"apples, basil, bean, rue, oregano, onion\"\n", + "plant_list = get_plant_list(input_plant_text)\n", + "extracted_mat = get_compatibility_matrix(plant_list)\n", + "print(extracted_mat)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## langchain additional context and fine tuning" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# process the plant compatibility matrix to a json\n", + "import csv\n", + "import json\n", + "\n", + "# Open the CSV file\n", + "with open('plant_compatability.csv', 'r') as file:\n", + " reader = csv.reader(file)\n", + " \n", + " # Read the header row to get the plant names\n", + " header = next(reader)\n", + " \n", + " # Create an empty dictionary to store the compatibility matrix\n", + " compatibility_matrix = {}\n", + " \n", + " # Iterate over the rows in the CSV file\n", + " for row in reader:\n", + " # Extract the plant name from the first column\n", + " plant = row[0]\n", + " \n", + " # Create a dictionary to store the compatibility values for the current plant\n", + " compatibility_values = {}\n", + " \n", + " # Iterate over the compatibility values in the row\n", + " for i, value in enumerate(row[1:], start=1):\n", + " # Extract the plant name from the header row\n", + " companion_plant = header[i]\n", + " \n", + " # Convert the compatibility value to an integer\n", + " compatibility = int(value) if value else 0\n", + " \n", + " # Add the compatibility value to the dictionary\n", + " compatibility_values[companion_plant] = compatibility\n", + " \n", + " # Add the compatibility values dictionary to the main compatibility matrix\n", + " compatibility_matrix[plant] = compatibility_values\n", + "\n", + "# Save the compatibility matrix as a JSON file\n", + "with open('compatibility_matrix.json', 'w') as file:\n", + " json.dump(compatibility_matrix, file, indent=4)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import openai\n", + "\n", + "# Load the compatibility matrix from the JSON file\n", + "with open('compatibility_matrix.json', 'r') as file:\n", + " compatibility_matrix = json.load(file)\n", + "\n", + "# Convert the compatibility matrix to a string\n", + "compatibility_matrix_text = json.dumps(compatibility_matrix)\n", + "with open('compatibilities_text.txt', 'r') as file:\n", + " # Read the contents of the file\n", + " compatibility_matrix_text = file.read()\n", + "\n", + "# Set up the LangChain API credentials\n", + "openai.api_key = OPENAI_API_KEY\n", + "\n", + "# Define the prompt for the GPT model\n", + "prompt = \"Can you provide companion plant suggestions for my garden given what you know about companion planting?\"\n", + "\n", + "# Concatenate the prompt and compatibility matrix text as the input to the GPT model\n", + "input_text = f\"{prompt}\\n\\n{compatibility_matrix_text}\"\n", + "\n", + "# Generate a response from the GPT model\n", + "response = openai.Completion.create(\n", + " engine='text-davinci-003',\n", + " prompt=input_text,\n", + " max_tokens=575\n", + ")\n", + "\n", + "print(response.choices[0])\n", + "# Extract the generated companion plant suggestions from the response\n", + "suggestions = response.choices[0].text.strip()\n", + "\n", + "# Print the companion plant suggestions\n", + "print(suggestions)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from langchain.client import Client\n", + "\n", + "# Load the fine-tuned GPT model\n", + "model = OpenAI(openai_api_key=OPENAI_API_KEY)\n", + "\n", + "# Load the knowledge base or context from websites or documents\n", + "knowledge_base = YourProcessedData()\n", + "\n", + "# Initialize the Langchain client\n", + "client = Client()\n", + "\n", + "# Set the context for the GPT model\n", + "context = \"Context from websites or documents\"\n", + "model.set_context(context)\n", + "\n", + "# Get companion plant compatibility predictions\n", + "plants = ['strawberries', 'mint', 'carrots', 'lettuce', 'basil']\n", + "predictions = []\n", + "\n", + "for plant in plants:\n", + " # Generate a question for each plant\n", + " question = f\"Which plants are compatible with {plant}?\"\n", + " \n", + " # Provide the question and context to the Langchain client\n", + " response = client.query(question, context=context)\n", + " \n", + " # Process and extract the answer from the response\n", + " answer = response['answer']\n", + " predictions.append((plant, answer))\n", + "\n", + "# Process and display the compatibility predictions\n", + "for plant, compatibility in predictions:\n", + " print(f\"{plant}: {compatibility}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import networkx as nx\n", + "import matplotlib.pyplot as plt\n", + "\n", + "# Define the plant list\n", + "plants = ['strawberries', 'mint', 'carrots', 'lettuce', 'basil', 'tomatoes', 'marigolds', 'lemons', 'strawberries', 'spinach', 'broccoli']\n", + "\n", + "# Define the compatibility matrix\n", + "compatibility_matrix = np.array([\n", + "[0, 1, 0, 0, 1, -1, 1, 0, 0, 0, -1],\n", + "[1, 0, 0, 0, 1, -1, 1, 0, 1, 0, -1],\n", + "[0, 0, 0, -1, 0, 1, 0, 0, 0, 1, 0],\n", + "[0, 0, -1, 0, 0, 1, 0, 0, 0, 1, 0],\n", + "[1, 1, 0, 0, 0, -1, 1, 0, 0, 0, -1],\n", + "[-1, -1, 1, 1, -1, 0, -1, 0, 0, 0, 1],\n", + "[1, 1, 0, 0, 1, -1, 0, 0, 0, 0, -1],\n", + "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n", + "[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n", + "[0, 0, 1, 1, 0, 0, 0, 0, 0, 0, -1],\n", + "[-1, -1, 0, 0, -1, 1, -1, 0, 0, -1, 0]\n", + "])\n", + "\n", + "# Create an empty graph\n", + "G = nx.Graph()\n", + "\n", + "# Add nodes (plants) to the graph\n", + "G.add_nodes_from(plants)\n", + "\n", + "# Add edges (compatibility) to the graph\n", + "for i in range(len(plants)):\n", + " for j in range(i + 1, len(plants)):\n", + " if compatibility_matrix[i][j] == 0:\n", + " color = 'grey'\n", + " elif compatibility_matrix[i][j] == -1:\n", + " color = 'pink'\n", + " else:\n", + " color = 'green'\n", + " G.add_edge(plants[i], plants[j], color=color)\n", + "\n", + "# Plot the graph\n", + "pos = nx.spring_layout(G)\n", + "colors = [G[u][v]['color'] for u, v in G.edges()]\n", + "nx.draw_networkx(G, pos, with_labels=True, node_color='lightgreen', edge_color=colors, width=2.0, alpha=0.8)\n", + "\n", + "# Set edge colors in the legend\n", + "color_legend = {'Neutral': 'grey', 'Negative': 'pink', 'Positive': 'green'}\n", + "legend_lines = [plt.Line2D([0], [0], color=color, linewidth=3) for color in color_legend.values()]\n", + "legend_labels = list(color_legend.keys())\n", + "plt.legend(legend_lines, legend_labels, loc='best')\n", + "\n", + "# Show the plot\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import streamlit as st\n", + "import networkx as nx\n", + "import plotly.graph_objects as go\n", + "\n", + "# Define the plants and compatibility matrix\n", + "plants = ['strawberries', 'mint', 'carrots', 'lettuce', 'basil', 'tomatoes', 'marigolds', 'lemons', 'strawberries', 'spinach', 'broccoli']\n", + "compatibility_matrix = [\n", + " [0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1],\n", + " [1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1],\n", + " [0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1],\n", + " [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1],\n", + " [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1],\n", + " [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n", + " [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1],\n", + " [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n", + " [0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1],\n", + " [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1],\n", + " [1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0]\n", + "]\n", + "\n", + "# Create a directed graph\n", + "G = nx.DiGraph()\n", + "\n", + "# Add nodes to the graph\n", + "G.add_nodes_from(plants)\n", + "\n", + "# Define positions for the nodes\n", + "pos = nx.spring_layout(G)\n", + "\n", + "# Assign positions to the nodes\n", + "for node, position in pos.items():\n", + " G.nodes[node]['pos'] = position\n", + "\n", + "# Iterate over the compatibility matrix and add edges with corresponding colors\n", + "for i in range(len(plants)):\n", + " for j in range(len(plants)):\n", + " if compatibility_matrix[i][j] == -1:\n", + " G.add_edge(plants[i], plants[j], color='red')\n", + " elif compatibility_matrix[i][j] == 1:\n", + " G.add_edge(plants[i], plants[j], color='green')\n", + " else:\n", + " G.add_edge(plants[i], plants[j], color='lightgray')\n", + "\n", + "# Create edge traces\n", + "# Create edge traces\n", + "edge_traces = []\n", + "for edge in G.edges():\n", + " x0, y0 = G.nodes[edge[0]]['pos']\n", + " x1, y1 = G.nodes[edge[1]]['pos']\n", + " color = G.edges[edge]['color']\n", + " trace = go.Scatter(x=[x0, x1, None], y=[y0, y1, None], mode='lines', line=dict(color=color, width=2))\n", + " edge_traces.append(trace)\n", + "\n", + "# Create node traces\n", + "node_traces = []\n", + "for node in G.nodes():\n", + " x, y = G.nodes[node]['pos']\n", + " trace = go.Scatter(x=[x], y=[y], mode='markers', marker=dict(color='black', size=10), name=node)\n", + " node_traces.append(trace)\n", + "\n", + "# Create figure\n", + "fig = go.Figure(data=edge_traces + node_traces)\n", + "\n", + "# Set layout options\n", + "fig.update_layout(\n", + " title='Plant Network',\n", + " showlegend=False,\n", + " hovermode='closest',\n", + " margin=dict(b=20, l=5, r=5, t=40),\n", + " xaxis=dict(showgrid=False, zeroline=False, showticklabels=False),\n", + " yaxis=dict(showgrid=False, zeroline=False, showticklabels=False)\n", + ")\n", + "\n", + "# Render the graph\n", + "#st.plotly_chart(fig)\n", + "fig" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import streamlit as st\n", + "import networkx as nx\n", + "import plotly.graph_objects as go\n", + "\n", + "# Define the plants and compatibility matrix\n", + "plants = ['strawberries', 'mint', 'carrots', 'lettuce', 'basil', 'tomatoes', 'marigolds', 'lemons', 'strawberries', 'spinach', 'broccoli']\n", + "compatibility_matrix = [\n", + " [0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1],\n", + " [1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1],\n", + " [0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1],\n", + " [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1],\n", + " [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1],\n", + " [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n", + " [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1],\n", + " [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],\n", + " [0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1],\n", + " [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1],\n", + " [1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0]\n", + "]\n", + "\n", + "# Create the graph\n", + "G = nx.Graph()\n", + "G.add_nodes_from(plants)\n", + "for i in range(len(plants)):\n", + " for j in range(i + 1, len(plants)):\n", + " if compatibility_matrix[i][j] == 0:\n", + " G.add_edge(plants[i], plants[j], color='lightgrey')\n", + " else:\n", + " G.add_edge(plants[i], plants[j], color='green' if compatibility_matrix[i][j] == 1 else 'pink')\n", + "\n", + "# Generate positions for the nodes\n", + "pos = nx.spring_layout(G)\n", + "\n", + "# Create node trace\n", + "node_trace = go.Scatter(\n", + " x=[pos[node][0] for node in G.nodes()],\n", + " y=[pos[node][1] for node in G.nodes()],\n", + " text=list(G.nodes()),\n", + " mode='markers+text',\n", + " textposition='top center',\n", + " hoverinfo='text',\n", + " marker=dict(\n", + " size=20,\n", + " color='lightblue',\n", + " line_width=2,\n", + " )\n", + ")\n", + "\n", + "# Create edge trace\n", + "edge_trace = go.Scatter(\n", + " x=[],\n", + " y=[],\n", + " line=dict(width=1, color='lightgrey'),\n", + " hoverinfo='none',\n", + " mode='lines'\n", + ")\n", + "\n", + "# Add coordinates to edge trace\n", + "for edge in G.edges():\n", + " x0, y0 = pos[edge[0]]\n", + " x1, y1 = pos[edge[1]]\n", + " edge_trace['x'] += tuple([x0, x1, None])\n", + " edge_trace['y'] += tuple([y0, y1, None])\n", + "\n", + "# Create edge traces for colored edges\n", + "edge_traces = []\n", + "for edge in G.edges(data=True):\n", + " x0, y0 = pos[edge[0]]\n", + " x1, y1 = pos[edge[1]]\n", + " color = edge[2]['color']\n", + " trace = go.Scatter(\n", + " x=[x0, x1],\n", + " y=[y0, y1],\n", + " mode='lines',\n", + " line=dict(width=2, color=color),\n", + " hoverinfo='none'\n", + " )\n", + " edge_traces.append(trace)\n", + "\n", + "# Create layout\n", + "layout = go.Layout(\n", + " title='Plant Compatibility Network Graph',\n", + " showlegend=False,\n", + " hovermode='closest',\n", + " margin=dict(b=20, l=5, r=5, t=40),\n", + " xaxis=dict(showgrid=False, zeroline=False, showticklabels=False),\n", + " yaxis=dict(showgrid=False, zeroline=False, showticklabels=False)\n", + ")\n", + "\n", + "# Create figure\n", + "fig = go.Figure(data=[edge_trace, *edge_traces, node_trace], layout=layout)\n", + "\n", + "# Render the graph using Plotly in Streamlit\n", + "st.plotly_chart(fig)\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import random\n", + "import numpy as np\n", + "\n", + "# Define the compatibility matrix\n", + "compatibility_matrix = np.array([\n", + " [-1, 1, 0, -1],\n", + " [1, -1, 1, -1],\n", + " [1, 0, -1, 1],\n", + " [-1, -1, 1, -1]\n", + "])\n", + "\n", + "# Define the user-selected plants, number of plant beds, and constraints\n", + "user_plants = [\"A\", \"B\", \"C\", \"D\"]\n", + "num_plant_beds = 4\n", + "min_species_per_bed = 1\n", + "max_species_per_bed = 2\n", + "\n", + "# Genetic Algorithm parameters\n", + "population_size = 50\n", + "num_generations = 100\n", + "tournament_size = 3\n", + "crossover_rate = 0.8\n", + "mutation_rate = 0.1\n", + "\n", + "# Generate an initial population randomly\n", + "def generate_initial_population():\n", + " population = []\n", + " for _ in range(population_size):\n", + " grouping = []\n", + " for _ in range(num_plant_beds):\n", + " num_species = random.randint(min_species_per_bed, max_species_per_bed)\n", + " species = random.sample(user_plants, num_species)\n", + " grouping.append(species)\n", + " population.append(grouping)\n", + " return population\n", + "\n", + "# Calculate the fitness score of a grouping\n", + "def calculate_fitness(grouping):\n", + " score = 0\n", + " for bed1 in range(num_plant_beds):\n", + " for bed2 in range(bed1 + 1, num_plant_beds):\n", + " for species1 in grouping[bed1]:\n", + " for species2 in grouping[bed2]:\n", + " species1_index = user_plants.index(species1)\n", + " species2_index = user_plants.index(species2)\n", + " score += compatibility_matrix[species1_index][species2_index]\n", + " return score\n", + "\n", + "# Perform tournament selection\n", + "def tournament_selection(population):\n", + " selected = []\n", + " for _ in range(population_size):\n", + " participants = random.sample(population, tournament_size)\n", + " winner = max(participants, key=calculate_fitness)\n", + " selected.append(winner)\n", + " return selected\n", + "\n", + "# Perform crossover between two parents\n", + "def crossover(parent1, parent2):\n", + " if random.random() < crossover_rate:\n", + " crossover_point = random.randint(1, num_plant_beds - 1)\n", + " child1 = parent1[:crossover_point] + parent2[crossover_point:]\n", + " child2 = parent2[:crossover_point] + parent1[crossover_point:]\n", + " return child1, child2\n", + " else:\n", + " return parent1, parent2\n", + "\n", + "# Perform mutation on an individual\n", + "def mutate(individual):\n", + " if random.random() < mutation_rate:\n", + " mutated_bed = random.randint(0, num_plant_beds - 1)\n", + " new_species = random.sample(user_plants, random.randint(min_species_per_bed, max_species_per_bed))\n", + " individual[mutated_bed] = new_species\n", + " return individual\n", + "\n", + "# Perform replacement of the population with the offspring\n", + "def replacement(population, offspring):\n", + " sorted_population = sorted(population, key=calculate_fitness, reverse=True)\n", + " sorted_offspring = sorted(offspring, key=calculate_fitness, reverse=True)\n", + " return sorted_population[:population_size - len(offspring)] + sorted_offspring\n", + "\n", + "# Genetic Algorithm main function\n", + "def genetic_algorithm():\n", + " population = generate_initial_population()\n", + "\n", + " for generation in range(num_generations):\n", + " print(f\"Generation {generation + 1}\")\n", + "\n", + " selected_population = tournament_selection(population)\n", + " offspring = []\n", + "\n", + " for _ in range(population_size // 2):\n", + " parent1 = random.choice(selected_population)\n", + " parent2 = random.choice(selected_population)\n", + " child1, child2 = crossover(parent1, parent2)\n", + " child1 = mutate(child1)\n", + " child2 = mutate(child2)\n", + " offspring.extend([child1, child2])\n", + "\n", + " population = replacement(population, offspring)\n", + "\n", + " best_grouping = max(population, key=calculate_fitness)\n", + " best_fitness = calculate_fitness(best_grouping)\n", + " print(f\"Best Grouping: {best_grouping}\")\n", + " print(f\"Fitness Score: {best_fitness}\")\n", + "\n", + "# Run the Genetic Algorithm\n", + "genetic_algorithm()\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "def query_farmersalmanac(title, first_paragraph_only=True):\n", + " base_url = \"https://www.almanac.com/companion-planting-guide-vegetables\"\n", + " url = f\"{base_url}/w/api.php?format=json&action=query&prop=extracts&explaintext=1&titles={title}\"\n", + " if first_paragraph_only:\n", + " url += \"&exintro=1\"\n", + " data = requests.get(url).json()\n", + " return Document(\n", + " metadata={\"source\": f\"{base_url}\"},\n", + " page_content=list(data[\"query\"][\"pages\"].values())[0][\"extract\"],\n", + " )" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## future with sources\n", + "- https://dzlab.github.io/2023/01/02/prompt-langchain/\n", + "- https://techcommunity.microsoft.com/t5/startups-at-microsoft/build-a-chatbot-to-query-your-documentation-using-langchain-and/ba-p/3833134" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "GRDN_env", + "language": "python", + "name": "grdn_env" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.9" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/notebooks/llamaindex_llama2_test.ipynb b/notebooks/llamaindex_llama2_test.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..8d8f2eb3aec74588c780683fb1e215be14015ffc --- /dev/null +++ b/notebooks/llamaindex_llama2_test.ipynb @@ -0,0 +1,258 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "import streamlit as st\n", + "import pandas as pd\n", + "import os\n", + "import replicate\n", + "from langchain.chat_models import ChatOpenAI\n", + "from langchain.prompts.chat import (\n", + " ChatPromptTemplate,\n", + " SystemMessagePromptTemplate,\n", + " AIMessagePromptTemplate,\n", + " HumanMessagePromptTemplate,\n", + ")\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "assistant: 😄 Oh my daisies, companion planting? It's like peas in a pod, ya know? 😂 It's like having a garden party with all your plant friends! 🎉 Companion planting is the bee's knees, it's like a garden symphony, all the plants working together in harmony! 🎶 And let me tell you, it's not just about looks, it's like a big ol' hug for your plants! 🤗 It's like planting a big ol' bouquet of flowers, all mixed together, just like a big ol' garden party! 🎉\n", + "But seriously, companion planting is a great way to create a balanced and healthy garden ecosystem. It's like having a little garden family, all working together to keep the pests away and the soil healthy! 🐝🐜 And let me tell you, it's not just about the plants, it's like a big ol' party for the bees and butterflies too! 🐝🦋 They love all the different colors and scents, it's like a big ol' garden buffet for them! 🍴🍸 So, if you haven't tried companion planting yet, you should give it a go, it's like the bee's knees, it's the cat's pajamas! 🐰👠💤\n", + "But enough about that, let's talk about you, what do you think about companion planting? Have you tried it before? Do you have any questions? Let's chat, I'm all ears! 🐰👂💬\n" + ] + } + ], + "source": [ + "from llama_index.llms import Replicate, ChatMessage\n", + "\n", + "llm = Replicate(\n", + " model=\"a16z-infra/llama13b-v2-chat:df7690f1994d94e96ad9d568eac121aecf50684a0b0963b25a41cc40061269e5\"\n", + ")\n", + "\n", + "messages = [\n", + " ChatMessage(\n", + " role=\"system\", content=\"You are a gardnere with a colorful personality\"\n", + " ),\n", + " ChatMessage(role=\"user\", content=\"What is your opinion on companion planting?\"),\n", + "]\n", + "resp = llm.chat(messages)\n", + "\n", + "print(resp)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "You return JUST a python list object containing the elements that can be grown in a garden. Do not include any other text or explanation.which of the elements of this list can be grown in a garden, [apple, orange, milk, eraser, cherry]? Return JUST a python list object containing the elements that can be grown in a garden. Do not include any other text or explanation.\n" + ] + }, + { + "ename": "ReplicateError", + "evalue": "You have reached the free time limit. To continue using Replicate, set up billing at https://replicate.com/account/billing#billing.", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mReplicateError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[13], line 20\u001b[0m\n\u001b[1;32m 17\u001b[0m input_prompt \u001b[39m=\u001b[39m template \u001b[39m+\u001b[39m text\n\u001b[1;32m 18\u001b[0m \u001b[39mprint\u001b[39m(input_prompt)\n\u001b[0;32m---> 20\u001b[0m resp \u001b[39m=\u001b[39m llm\u001b[39m.\u001b[39mcomplete(input_prompt)\n\u001b[1;32m 21\u001b[0m \u001b[39mprint\u001b[39m(resp)\n", + "File \u001b[0;32m~/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/llama_index/llms/base.py:223\u001b[0m, in \u001b[0;36mllm_completion_callback..wrap..wrapped_llm_predict\u001b[0;34m(_self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 213\u001b[0m \u001b[39mwith\u001b[39;00m wrapper_logic(_self) \u001b[39mas\u001b[39;00m callback_manager:\n\u001b[1;32m 214\u001b[0m event_id \u001b[39m=\u001b[39m callback_manager\u001b[39m.\u001b[39mon_event_start(\n\u001b[1;32m 215\u001b[0m CBEventType\u001b[39m.\u001b[39mLLM,\n\u001b[1;32m 216\u001b[0m payload\u001b[39m=\u001b[39m{\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 220\u001b[0m },\n\u001b[1;32m 221\u001b[0m )\n\u001b[0;32m--> 223\u001b[0m f_return_val \u001b[39m=\u001b[39m f(_self, \u001b[39m*\u001b[39margs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n\u001b[1;32m 224\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39misinstance\u001b[39m(f_return_val, Generator):\n\u001b[1;32m 225\u001b[0m \u001b[39m# intercept the generator and add a callback to the end\u001b[39;00m\n\u001b[1;32m 226\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mwrapped_gen\u001b[39m() \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m CompletionResponseGen:\n", + "File \u001b[0;32m~/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/llama_index/llms/replicate.py:100\u001b[0m, in \u001b[0;36mReplicate.complete\u001b[0;34m(self, prompt, **kwargs)\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[39m@llm_completion_callback\u001b[39m()\n\u001b[1;32m 99\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mcomplete\u001b[39m(\u001b[39mself\u001b[39m, prompt: \u001b[39mstr\u001b[39m, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs: Any) \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m CompletionResponse:\n\u001b[0;32m--> 100\u001b[0m response_gen \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mstream_complete(prompt, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n\u001b[1;32m 101\u001b[0m response_list \u001b[39m=\u001b[39m \u001b[39mlist\u001b[39m(response_gen)\n\u001b[1;32m 102\u001b[0m final_response \u001b[39m=\u001b[39m response_list[\u001b[39m-\u001b[39m\u001b[39m1\u001b[39m]\n", + "File \u001b[0;32m~/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/llama_index/llms/base.py:223\u001b[0m, in \u001b[0;36mllm_completion_callback..wrap..wrapped_llm_predict\u001b[0;34m(_self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 213\u001b[0m \u001b[39mwith\u001b[39;00m wrapper_logic(_self) \u001b[39mas\u001b[39;00m callback_manager:\n\u001b[1;32m 214\u001b[0m event_id \u001b[39m=\u001b[39m callback_manager\u001b[39m.\u001b[39mon_event_start(\n\u001b[1;32m 215\u001b[0m CBEventType\u001b[39m.\u001b[39mLLM,\n\u001b[1;32m 216\u001b[0m payload\u001b[39m=\u001b[39m{\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 220\u001b[0m },\n\u001b[1;32m 221\u001b[0m )\n\u001b[0;32m--> 223\u001b[0m f_return_val \u001b[39m=\u001b[39m f(_self, \u001b[39m*\u001b[39margs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n\u001b[1;32m 224\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39misinstance\u001b[39m(f_return_val, Generator):\n\u001b[1;32m 225\u001b[0m \u001b[39m# intercept the generator and add a callback to the end\u001b[39;00m\n\u001b[1;32m 226\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mwrapped_gen\u001b[39m() \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m CompletionResponseGen:\n", + "File \u001b[0;32m~/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/llama_index/llms/replicate.py:119\u001b[0m, in \u001b[0;36mReplicate.stream_complete\u001b[0;34m(self, prompt, **kwargs)\u001b[0m\n\u001b[1;32m 117\u001b[0m prompt \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mcompletion_to_prompt(prompt)\n\u001b[1;32m 118\u001b[0m input_dict \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_get_input_dict(prompt, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n\u001b[0;32m--> 119\u001b[0m response_iter \u001b[39m=\u001b[39m replicate\u001b[39m.\u001b[39mrun(\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mmodel, \u001b[39minput\u001b[39m\u001b[39m=\u001b[39minput_dict)\n\u001b[1;32m 121\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mgen\u001b[39m() \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m CompletionResponseGen:\n\u001b[1;32m 122\u001b[0m text \u001b[39m=\u001b[39m \u001b[39m\"\u001b[39m\u001b[39m\"\u001b[39m\n", + "File \u001b[0;32m~/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/replicate/client.py:147\u001b[0m, in \u001b[0;36mClient.run\u001b[0;34m(self, ref, input, **params)\u001b[0m\n\u001b[1;32m 137\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mrun\u001b[39m(\n\u001b[1;32m 138\u001b[0m \u001b[39mself\u001b[39m,\n\u001b[1;32m 139\u001b[0m ref: \u001b[39mstr\u001b[39m,\n\u001b[1;32m 140\u001b[0m \u001b[39minput\u001b[39m: Optional[Dict[\u001b[39mstr\u001b[39m, Any]] \u001b[39m=\u001b[39m \u001b[39mNone\u001b[39;00m,\n\u001b[1;32m 141\u001b[0m \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mparams: Unpack[\u001b[39m\"\u001b[39m\u001b[39mPredictions.CreatePredictionParams\u001b[39m\u001b[39m\"\u001b[39m],\n\u001b[1;32m 142\u001b[0m ) \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m Union[Any, Iterator[Any]]: \u001b[39m# noqa: ANN401\u001b[39;00m\n\u001b[1;32m 143\u001b[0m \u001b[39m \u001b[39m\u001b[39m\"\"\"\u001b[39;00m\n\u001b[1;32m 144\u001b[0m \u001b[39m Run a model and wait for its output.\u001b[39;00m\n\u001b[1;32m 145\u001b[0m \u001b[39m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 147\u001b[0m \u001b[39mreturn\u001b[39;00m run(\u001b[39mself\u001b[39m, ref, \u001b[39minput\u001b[39m, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mparams)\n", + "File \u001b[0;32m~/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/replicate/run.py:31\u001b[0m, in \u001b[0;36mrun\u001b[0;34m(client, ref, input, **params)\u001b[0m\n\u001b[1;32m 28\u001b[0m version, owner, name, version_id \u001b[39m=\u001b[39m identifier\u001b[39m.\u001b[39m_resolve(ref)\n\u001b[1;32m 30\u001b[0m \u001b[39mif\u001b[39;00m version_id \u001b[39mis\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[0;32m---> 31\u001b[0m prediction \u001b[39m=\u001b[39m client\u001b[39m.\u001b[39mpredictions\u001b[39m.\u001b[39mcreate(\n\u001b[1;32m 32\u001b[0m version\u001b[39m=\u001b[39mversion_id, \u001b[39minput\u001b[39m\u001b[39m=\u001b[39m\u001b[39minput\u001b[39m \u001b[39mor\u001b[39;00m {}, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mparams\n\u001b[1;32m 33\u001b[0m )\n\u001b[1;32m 34\u001b[0m \u001b[39melif\u001b[39;00m owner \u001b[39mand\u001b[39;00m name:\n\u001b[1;32m 35\u001b[0m prediction \u001b[39m=\u001b[39m client\u001b[39m.\u001b[39mmodels\u001b[39m.\u001b[39mpredictions\u001b[39m.\u001b[39mcreate(\n\u001b[1;32m 36\u001b[0m model\u001b[39m=\u001b[39m(owner, name), \u001b[39minput\u001b[39m\u001b[39m=\u001b[39m\u001b[39minput\u001b[39m \u001b[39mor\u001b[39;00m {}, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mparams\n\u001b[1;32m 37\u001b[0m )\n", + "File \u001b[0;32m~/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/replicate/prediction.py:309\u001b[0m, in \u001b[0;36mPredictions.create\u001b[0;34m(self, version, input, **params)\u001b[0m\n\u001b[1;32m 300\u001b[0m \u001b[39m\u001b[39m\u001b[39m\"\"\"\u001b[39;00m\n\u001b[1;32m 301\u001b[0m \u001b[39mCreate a new prediction for the specified model version.\u001b[39;00m\n\u001b[1;32m 302\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[1;32m 304\u001b[0m body \u001b[39m=\u001b[39m _create_prediction_body(\n\u001b[1;32m 305\u001b[0m version,\n\u001b[1;32m 306\u001b[0m \u001b[39minput\u001b[39m,\n\u001b[1;32m 307\u001b[0m \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mparams,\n\u001b[1;32m 308\u001b[0m )\n\u001b[0;32m--> 309\u001b[0m resp \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_client\u001b[39m.\u001b[39m_request(\n\u001b[1;32m 310\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mPOST\u001b[39m\u001b[39m\"\u001b[39m,\n\u001b[1;32m 311\u001b[0m \u001b[39m\"\u001b[39m\u001b[39m/v1/predictions\u001b[39m\u001b[39m\"\u001b[39m,\n\u001b[1;32m 312\u001b[0m json\u001b[39m=\u001b[39mbody,\n\u001b[1;32m 313\u001b[0m )\n\u001b[1;32m 315\u001b[0m \u001b[39mreturn\u001b[39;00m _json_to_prediction(\u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_client, resp\u001b[39m.\u001b[39mjson())\n", + "File \u001b[0;32m~/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/replicate/client.py:85\u001b[0m, in \u001b[0;36mClient._request\u001b[0;34m(self, method, path, **kwargs)\u001b[0m\n\u001b[1;32m 83\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m_request\u001b[39m(\u001b[39mself\u001b[39m, method: \u001b[39mstr\u001b[39m, path: \u001b[39mstr\u001b[39m, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs) \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m httpx\u001b[39m.\u001b[39mResponse:\n\u001b[1;32m 84\u001b[0m resp \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_client\u001b[39m.\u001b[39mrequest(method, path, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n\u001b[0;32m---> 85\u001b[0m _raise_for_status(resp)\n\u001b[1;32m 87\u001b[0m \u001b[39mreturn\u001b[39;00m resp\n", + "File \u001b[0;32m~/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/replicate/client.py:358\u001b[0m, in \u001b[0;36m_raise_for_status\u001b[0;34m(resp)\u001b[0m\n\u001b[1;32m 356\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m_raise_for_status\u001b[39m(resp: httpx\u001b[39m.\u001b[39mResponse) \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m \u001b[39mNone\u001b[39;00m:\n\u001b[1;32m 357\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39m400\u001b[39m \u001b[39m<\u001b[39m\u001b[39m=\u001b[39m resp\u001b[39m.\u001b[39mstatus_code \u001b[39m<\u001b[39m \u001b[39m600\u001b[39m:\n\u001b[0;32m--> 358\u001b[0m \u001b[39mraise\u001b[39;00m ReplicateError(resp\u001b[39m.\u001b[39mjson()[\u001b[39m\"\u001b[39m\u001b[39mdetail\u001b[39m\u001b[39m\"\u001b[39m])\n", + "\u001b[0;31mReplicateError\u001b[0m: You have reached the free time limit. To continue using Replicate, set up billing at https://replicate.com/account/billing#billing." + ] + } + ], + "source": [ + "from llama_index.llms import Replicate\n", + "\n", + "llm = Replicate(\n", + " model=\"a16z-infra/llama13b-v2-chat:df7690f1994d94e96ad9d568eac121aecf50684a0b0963b25a41cc40061269e5\",\n", + " temperature=0.1,\n", + " #context_window=32,\n", + " top_p=0.9,\n", + " repetition_penalty=1.0,\n", + " max_tokens=2000,\n", + " #stop_sequences=[\"\\n\\n\"], \n", + "\n", + ")\n", + "\n", + "input_plant_text = 'apple, orange, milk, eraser, cherry'\n", + "template=\"You return JUST a python list object containing the elements that can be grown in a garden. Do not include any other text or explanation.\"\n", + "text = 'which of the elements of this list can be grown in a garden, [' + input_plant_text + ']? Return JUST a python list object containing the elements that can be grown in a garden. Do not include any other text or explanation.'\n", + "input_prompt = template + text\n", + "print(input_prompt)\n", + "\n", + "resp = llm.complete(input_prompt)\n", + "print(resp)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Companion planting is the practice of growing different plants together in close proximity in order to improve their growth, health, and productivity. This technique takes advantage of the different ways that plants interact with each other, such as by providing shade, repelling pests, or attracting beneficial insects.\n", + "\n", + "Here are some of my thoughts on companion planting:\n", + "\n", + "1. Diversify your garden: Companion planting is a great way to add diversity to your garden, which can improve its overall health and resilience. By growing a mix of plants, you can create a more complex and dynamic ecosystem that is less susceptible to pests and diseases.\n", + "2. Improve soil health: Many companion plants, such as legumes and comfrey, have the ability to fix nitrogen or other nutrients in the soil, which can improve the health and fertility of the soil. This can lead to healthier and more productive plants.\n", + "3. Enhance pest control: Companion planting can be a powerful tool for controlling pests naturally. For example, basil and mint can repel aphids, while marigold and nasturtium can attract beneficial insects that prey on pests.\n", + "4. Increase yields: Companion planting can also help to increase yields by providing support and shade for plants, or by attracting beneficial insects that pollinate or prey on pests. For example, planting beans with corn and squash can provide a trellis for the beans and shade for the corn, while also attracting beneficial insects that prey on pests.\n", + "5. Reduce maintenance: Companion planting can also reduce the amount of maintenance required in your garden. For example, planting a mix of plants that have different growing habits and blooming times can create a more dynamic and resilient garden that requires less work to maintain.\n", + "\n", + "\n", + "Overall, I believe that companion planting is a valuable technique for gardeners of all experience levels. It can help to improve the health, productivity, and resilience of your garden, while also reducing the amount of maintenance required. By taking advantage of the different ways that plants interact with each other" + ] + } + ], + "source": [ + "#os.environ[\"REPLICATE_API_TOKEN\"] = \"key here\"\n", + "api = replicate.Client(api_token=os.environ[\"REPLICATE_API_TOKEN\"])\n", + "output = api.run(\n", + " \"a16z-infra/llama13b-v2-chat:df7690f1994d94e96ad9d568eac121aecf50684a0b0963b25a41cc40061269e5\",\n", + " input={\"prompt\": \"what is your opinion on companion planting?\"},\n", + " )\n", + "for item in output:\n", + " print(item, end=\"\")\n", + "\n", + "# save response to string\n", + "resp = \"\"\n", + "for item in output:\n", + " resp += item\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "config.json: 100%|██████████| 638/638 [00:00<00:00, 3.22MB/s]\n", + "model.safetensors.index.json: 100%|██████████| 23.9k/23.9k [00:00<00:00, 62.9MB/s]\n", + "model-00001-of-00008.safetensors: 100%|██████████| 1.89G/1.89G [00:26<00:00, 71.1MB/s]\n", + "model-00002-of-00008.safetensors: 100%|██████████| 1.95G/1.95G [00:27<00:00, 71.0MB/s]\n", + "model-00003-of-00008.safetensors: 100%|██████████| 1.98G/1.98G [00:27<00:00, 72.0MB/s]\n", + "model-00004-of-00008.safetensors: 100%|██████████| 1.95G/1.95G [00:27<00:00, 70.2MB/s]\n", + "model-00005-of-00008.safetensors: 100%|██████████| 1.98G/1.98G [00:28<00:00, 69.8MB/s]\n", + "model-00006-of-00008.safetensors: 100%|██████████| 1.95G/1.95G [00:28<00:00, 69.5MB/s]\n", + "model-00007-of-00008.safetensors: 100%|██████████| 1.98G/1.98G [00:28<00:00, 68.5MB/s]\n", + "model-00008-of-00008.safetensors: 100%|██████████| 816M/816M [00:11<00:00, 69.9MB/s]\n", + "Downloading shards: 100%|██████████| 8/8 [03:27<00:00, 25.96s/it]\n", + "Loading checkpoint shards: 100%|██████████| 8/8 [00:24<00:00, 3.04s/it]\n", + "generation_config.json: 100%|██████████| 111/111 [00:00<00:00, 1.12MB/s]\n", + "tokenizer_config.json: 100%|██████████| 1.43k/1.43k [00:00<00:00, 9.73MB/s]\n", + "tokenizer.model: 100%|██████████| 493k/493k [00:00<00:00, 69.9MB/s]\n", + "tokenizer.json: 100%|██████████| 1.80M/1.80M [00:00<00:00, 17.9MB/s]\n", + "added_tokens.json: 100%|██████████| 42.0/42.0 [00:00<00:00, 160kB/s]\n", + "special_tokens_map.json: 100%|██████████| 168/168 [00:00<00:00, 961kB/s]\n", + "/Users/dheym/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/transformers/generation/utils.py:1518: UserWarning: You have modified the pretrained model configuration to control generation. This is a deprecated strategy to control generation and will be removed soon, in a future version. Please use and modify the model generation configuration (see https://huggingface.co/docs/transformers/generation_strategies#default-text-generation-configuration )\n", + " warnings.warn(\n" + ] + }, + { + "ename": "ValueError", + "evalue": "Greedy methods without beam search do not support `num_return_sequences` different than 1 (got 3).", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[7], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mtransformers\u001b[39;00m \u001b[39mimport\u001b[39;00m pipeline\n\u001b[1;32m 2\u001b[0m generator \u001b[39m=\u001b[39m pipeline(\u001b[39m'\u001b[39m\u001b[39mtext-generation\u001b[39m\u001b[39m'\u001b[39m, model \u001b[39m=\u001b[39m \u001b[39m'\u001b[39m\u001b[39mHuggingFaceH4/zephyr-7b-beta\u001b[39m\u001b[39m'\u001b[39m)\n\u001b[0;32m----> 3\u001b[0m generator(\u001b[39m\"\u001b[39m\u001b[39mHello, I\u001b[39m\u001b[39m'\u001b[39m\u001b[39mm a language model\u001b[39m\u001b[39m\"\u001b[39m, max_length \u001b[39m=\u001b[39m \u001b[39m30\u001b[39m, num_return_sequences\u001b[39m=\u001b[39m\u001b[39m3\u001b[39m)\n", + "File \u001b[0;32m~/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/transformers/pipelines/text_generation.py:208\u001b[0m, in \u001b[0;36mTextGenerationPipeline.__call__\u001b[0;34m(self, text_inputs, **kwargs)\u001b[0m\n\u001b[1;32m 167\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m__call__\u001b[39m(\u001b[39mself\u001b[39m, text_inputs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs):\n\u001b[1;32m 168\u001b[0m \u001b[39m \u001b[39m\u001b[39m\"\"\"\u001b[39;00m\n\u001b[1;32m 169\u001b[0m \u001b[39m Complete the prompt(s) given as inputs.\u001b[39;00m\n\u001b[1;32m 170\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 206\u001b[0m \u001b[39m ids of the generated text.\u001b[39;00m\n\u001b[1;32m 207\u001b[0m \u001b[39m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 208\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39msuper\u001b[39m()\u001b[39m.\u001b[39m\u001b[39m__call__\u001b[39m(text_inputs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n", + "File \u001b[0;32m~/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/transformers/pipelines/base.py:1140\u001b[0m, in \u001b[0;36mPipeline.__call__\u001b[0;34m(self, inputs, num_workers, batch_size, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1132\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mnext\u001b[39m(\n\u001b[1;32m 1133\u001b[0m \u001b[39miter\u001b[39m(\n\u001b[1;32m 1134\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mget_iterator(\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1137\u001b[0m )\n\u001b[1;32m 1138\u001b[0m )\n\u001b[1;32m 1139\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[0;32m-> 1140\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mrun_single(inputs, preprocess_params, forward_params, postprocess_params)\n", + "File \u001b[0;32m~/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/transformers/pipelines/base.py:1147\u001b[0m, in \u001b[0;36mPipeline.run_single\u001b[0;34m(self, inputs, preprocess_params, forward_params, postprocess_params)\u001b[0m\n\u001b[1;32m 1145\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mrun_single\u001b[39m(\u001b[39mself\u001b[39m, inputs, preprocess_params, forward_params, postprocess_params):\n\u001b[1;32m 1146\u001b[0m model_inputs \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mpreprocess(inputs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mpreprocess_params)\n\u001b[0;32m-> 1147\u001b[0m model_outputs \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mforward(model_inputs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mforward_params)\n\u001b[1;32m 1148\u001b[0m outputs \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mpostprocess(model_outputs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mpostprocess_params)\n\u001b[1;32m 1149\u001b[0m \u001b[39mreturn\u001b[39;00m outputs\n", + "File \u001b[0;32m~/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/transformers/pipelines/base.py:1046\u001b[0m, in \u001b[0;36mPipeline.forward\u001b[0;34m(self, model_inputs, **forward_params)\u001b[0m\n\u001b[1;32m 1044\u001b[0m \u001b[39mwith\u001b[39;00m inference_context():\n\u001b[1;32m 1045\u001b[0m model_inputs \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_ensure_tensor_on_device(model_inputs, device\u001b[39m=\u001b[39m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mdevice)\n\u001b[0;32m-> 1046\u001b[0m model_outputs \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_forward(model_inputs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mforward_params)\n\u001b[1;32m 1047\u001b[0m model_outputs \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_ensure_tensor_on_device(model_outputs, device\u001b[39m=\u001b[39mtorch\u001b[39m.\u001b[39mdevice(\u001b[39m\"\u001b[39m\u001b[39mcpu\u001b[39m\u001b[39m\"\u001b[39m))\n\u001b[1;32m 1048\u001b[0m \u001b[39melse\u001b[39;00m:\n", + "File \u001b[0;32m~/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/transformers/pipelines/text_generation.py:271\u001b[0m, in \u001b[0;36mTextGenerationPipeline._forward\u001b[0;34m(self, model_inputs, **generate_kwargs)\u001b[0m\n\u001b[1;32m 268\u001b[0m generate_kwargs[\u001b[39m\"\u001b[39m\u001b[39mmin_length\u001b[39m\u001b[39m\"\u001b[39m] \u001b[39m+\u001b[39m\u001b[39m=\u001b[39m prefix_length\n\u001b[1;32m 270\u001b[0m \u001b[39m# BS x SL\u001b[39;00m\n\u001b[0;32m--> 271\u001b[0m generated_sequence \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mmodel\u001b[39m.\u001b[39mgenerate(input_ids\u001b[39m=\u001b[39minput_ids, attention_mask\u001b[39m=\u001b[39mattention_mask, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mgenerate_kwargs)\n\u001b[1;32m 272\u001b[0m out_b \u001b[39m=\u001b[39m generated_sequence\u001b[39m.\u001b[39mshape[\u001b[39m0\u001b[39m]\n\u001b[1;32m 273\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mframework \u001b[39m==\u001b[39m \u001b[39m\"\u001b[39m\u001b[39mpt\u001b[39m\u001b[39m\"\u001b[39m:\n", + "File \u001b[0;32m~/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/torch/utils/_contextlib.py:115\u001b[0m, in \u001b[0;36mcontext_decorator..decorate_context\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 112\u001b[0m \u001b[39m@functools\u001b[39m\u001b[39m.\u001b[39mwraps(func)\n\u001b[1;32m 113\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mdecorate_context\u001b[39m(\u001b[39m*\u001b[39margs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs):\n\u001b[1;32m 114\u001b[0m \u001b[39mwith\u001b[39;00m ctx_factory():\n\u001b[0;32m--> 115\u001b[0m \u001b[39mreturn\u001b[39;00m func(\u001b[39m*\u001b[39margs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n", + "File \u001b[0;32m~/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/transformers/generation/utils.py:1529\u001b[0m, in \u001b[0;36mGenerationMixin.generate\u001b[0;34m(self, inputs, generation_config, logits_processor, stopping_criteria, prefix_allowed_tokens_fn, synced_gpus, assistant_model, streamer, negative_prompt_ids, negative_prompt_attention_mask, **kwargs)\u001b[0m\n\u001b[1;32m 1527\u001b[0m generation_config \u001b[39m=\u001b[39m copy\u001b[39m.\u001b[39mdeepcopy(generation_config)\n\u001b[1;32m 1528\u001b[0m model_kwargs \u001b[39m=\u001b[39m generation_config\u001b[39m.\u001b[39mupdate(\u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs) \u001b[39m# All unused kwargs must be model kwargs\u001b[39;00m\n\u001b[0;32m-> 1529\u001b[0m generation_config\u001b[39m.\u001b[39mvalidate()\n\u001b[1;32m 1530\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_validate_model_kwargs(model_kwargs\u001b[39m.\u001b[39mcopy())\n\u001b[1;32m 1532\u001b[0m \u001b[39m# 2. Set generation parameters if not already defined\u001b[39;00m\n", + "File \u001b[0;32m~/anaconda3/envs/GRDN_env/lib/python3.11/site-packages/transformers/generation/configuration_utils.py:498\u001b[0m, in \u001b[0;36mGenerationConfig.validate\u001b[0;34m(self, is_init)\u001b[0m\n\u001b[1;32m 496\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mnum_beams \u001b[39m==\u001b[39m \u001b[39m1\u001b[39m:\n\u001b[1;32m 497\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mdo_sample \u001b[39mis\u001b[39;00m \u001b[39mFalse\u001b[39;00m:\n\u001b[0;32m--> 498\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\n\u001b[1;32m 499\u001b[0m \u001b[39m\"\u001b[39m\u001b[39mGreedy methods without beam search do not support `num_return_sequences` different than 1 \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[1;32m 500\u001b[0m \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m(got \u001b[39m\u001b[39m{\u001b[39;00m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mnum_return_sequences\u001b[39m}\u001b[39;00m\u001b[39m).\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[1;32m 501\u001b[0m )\n\u001b[1;32m 502\u001b[0m \u001b[39melif\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mnum_return_sequences \u001b[39m>\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mnum_beams:\n\u001b[1;32m 503\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mValueError\u001b[39;00m(\n\u001b[1;32m 504\u001b[0m \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m`num_return_sequences` (\u001b[39m\u001b[39m{\u001b[39;00m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mnum_return_sequences\u001b[39m}\u001b[39;00m\u001b[39m) has to be smaller or equal to `num_beams` \u001b[39m\u001b[39m\"\u001b[39m\n\u001b[1;32m 505\u001b[0m \u001b[39mf\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m(\u001b[39m\u001b[39m{\u001b[39;00m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mnum_beams\u001b[39m}\u001b[39;00m\u001b[39m).\u001b[39m\u001b[39m\"\u001b[39m\n\u001b[1;32m 506\u001b[0m )\n", + "\u001b[0;31mValueError\u001b[0m: Greedy methods without beam search do not support `num_return_sequences` different than 1 (got 3)." + ] + } + ], + "source": [ + "from transformers import pipeline\n", + "generator = pipeline('text-generation', model = 'HuggingFaceH4/zephyr-7b-beta')\n", + "generator(\"Hello, I'm a language model\", max_length = 30, num_return_sequences=3)\n", + "## [{'generated_text': \"Hello, I'm a language modeler. So while writing this, when I went out to meet my wife or come home she told me that my\"},\n", + "## {'generated_text': \"Hello, I'm a language modeler. I write and maintain software in Python. I love to code, and that includes coding things that require writing\"}, ...\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "# Stream text\n", + "def predict(message, chatbot, system_prompt=\"\", temperature=0.9, max_new_tokens=4096):\n", + " \n", + " client = Client(\"https://ysharma-explore-llamav2-with-tgi.hf.space/\")\n", + " return client.predict(\n", + " message, # str in 'Message' Textbox component\n", + " system_prompt, # str in 'Optional system prompt' Textbox component\n", + " temperature, # int | float (numeric value between 0.0 and 1.0)\n", + " max_new_tokens, # int | float (numeric value between 0 and 4096)\n", + " 0.3, # int | float (numeric value between 0.0 and 1)\n", + " 1, # int | float (numeric value between 1.0 and 2.0)\n", + " api_name=\"/chat\"\n", + " )\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "GRDN_env", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.3" + }, + "orig_nbformat": 4 + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/readme.md b/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..e8c7dc3e849ece997f8fff089e0f3e07179e6ff4 --- /dev/null +++ b/readme.md @@ -0,0 +1,56 @@ +# README +
+
+ GRDN 🌱 +
+author: Danielle Heymann +
+contact: dheymann314@gmail.com +
+last updated: 12/17/2023 +
+
+GRDN is an application that allows users to optimize a garden and its plant beds through companion planting, generative AI, and optimization. It is a work in progress. +
+
+
+ +## Background +info +
+
+![app1](src/assets/readme1.png) +
+
+![app2](src/assets/readme2.png) +
+
+![app3](src/assets/readme3.png) +
+
+![app4](src/assets/readme4.png) +
+
+![app5](src/assets/readme5.png) +
+
+ +## Setup +- setup conda environment + >*conda create --name=GRDN_env* +- install dependencies + >*pip install -r requirements.txt* +- download local model and add it to model folder + >I used LLama2 7B HF Chat model + >https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/blob/main/llama-2-7b-chat.Q4_K_M.gguf + +## Running App +- navigate to ...GRDN/src +- activate environment + >*conda activate GRDN_env* +- run app + >*python -m streamlit run app.py* + + + + diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e5243aaad46258f5fe89231a6327601b7b95ce6f Binary files /dev/null and b/src/.DS_Store differ diff --git a/src/assets/bot.png b/src/assets/bot.png new file mode 100644 index 0000000000000000000000000000000000000000..9a5729d5a681687a9f956f3e0593defc10672263 Binary files /dev/null and b/src/assets/bot.png differ diff --git a/src/assets/cool.png b/src/assets/cool.png new file mode 100644 index 0000000000000000000000000000000000000000..1ed57931194944fae83d15dead890198af834340 Binary files /dev/null and b/src/assets/cool.png differ diff --git a/src/assets/flower.jpg b/src/assets/flower.jpg new file mode 100644 index 0000000000000000000000000000000000000000..edf2fcc2120b940fa3c474c86104bf757aaadd07 --- /dev/null +++ b/src/assets/flower.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:021afe38c42b91bcb4fa95babbdc05a8db83f22848229f936dc736b0e7e45622 +size 1215909 diff --git a/src/assets/flower2.jpg b/src/assets/flower2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..359aec76e68791012c328b42607e5a43b90e3cb6 --- /dev/null +++ b/src/assets/flower2.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94c55ec305892fb47ee20da737c7c2525fc128290b1c84d7de09efbae97bde72 +size 1054333 diff --git a/src/assets/flower_tech.png b/src/assets/flower_tech.png new file mode 100644 index 0000000000000000000000000000000000000000..5dbad130e1cd3ce15dbb844dce426b7f58d89401 --- /dev/null +++ b/src/assets/flower_tech.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:651653c18781f505c0dd893e1c5534b1343b12a956dfb7878d786b6018506d4c +size 3035267 diff --git a/src/assets/lights.jpg b/src/assets/lights.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e4cc164a15df4c3340e6ca558b5d517d3d2d8dad Binary files /dev/null and b/src/assets/lights.jpg differ diff --git a/src/assets/logo_title.png b/src/assets/logo_title.png new file mode 100644 index 0000000000000000000000000000000000000000..6017877024cff22960be2d95f3d0a4990e431526 Binary files /dev/null and b/src/assets/logo_title.png differ diff --git a/src/assets/logo_title_transparent.png b/src/assets/logo_title_transparent.png new file mode 100644 index 0000000000000000000000000000000000000000..4dc8fdd950695045d36933d5c8d7d397767ea7e6 Binary files /dev/null and b/src/assets/logo_title_transparent.png differ diff --git a/src/assets/plant_images/plant_0.png b/src/assets/plant_images/plant_0.png new file mode 100644 index 0000000000000000000000000000000000000000..e8a0583686098e5eedb378dd989aa9ad2aaec834 --- /dev/null +++ b/src/assets/plant_images/plant_0.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cb5ee09ac948d36a52f59f653972fcda279d354b02b13c5fb268429f1134a9c6 +size 3147861 diff --git a/src/assets/plant_images/plant_1.png b/src/assets/plant_images/plant_1.png new file mode 100644 index 0000000000000000000000000000000000000000..added58f0f76aa7f64ea2fb6e82d701f75fdc1d0 --- /dev/null +++ b/src/assets/plant_images/plant_1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d965f1ea9f2024e10c7b077009df0f5987c936107313bfdf9e88b2708ac22c0c +size 3147861 diff --git a/src/assets/plant_images/plant_10.png b/src/assets/plant_images/plant_10.png new file mode 100644 index 0000000000000000000000000000000000000000..23d21db85df609a9c55ede69b172385556226bc6 --- /dev/null +++ b/src/assets/plant_images/plant_10.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c972946af2959a440fd2f5f78565d8267f403cf42e01dcb6feec5a4f725552f +size 3147861 diff --git a/src/assets/plant_images/plant_11.png b/src/assets/plant_images/plant_11.png new file mode 100644 index 0000000000000000000000000000000000000000..853a0731f9f72a3239b1a817380eb5235e86600a --- /dev/null +++ b/src/assets/plant_images/plant_11.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:00e3e53f67a29c8842441a2e3fad384cddb8fe3e9394b17a8f756fb84acbad0a +size 3147861 diff --git a/src/assets/plant_images/plant_12.png b/src/assets/plant_images/plant_12.png new file mode 100644 index 0000000000000000000000000000000000000000..3ba280a861bab559ae78ebc0e42e7037e96d4fce --- /dev/null +++ b/src/assets/plant_images/plant_12.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7ff58afdc10197acdbaacac383395313b6ed71ade41116af346109fc94cde030 +size 3147861 diff --git a/src/assets/plant_images/plant_13.png b/src/assets/plant_images/plant_13.png new file mode 100644 index 0000000000000000000000000000000000000000..029316c4c3fa9be72fb3076092f45bf15e989cb8 --- /dev/null +++ b/src/assets/plant_images/plant_13.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19ec740eba54864637231267b4f2fb9a4afaaf409eae547f35a2766bd51bdb1a +size 3147861 diff --git a/src/assets/plant_images/plant_14.png b/src/assets/plant_images/plant_14.png new file mode 100644 index 0000000000000000000000000000000000000000..a79c3f50632befd86aa41ade4631aacc8d800e09 --- /dev/null +++ b/src/assets/plant_images/plant_14.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:06248bf39c1be76c09ef8fac87dee464cc39bab82028334bc1e0da8538cc4079 +size 3147861 diff --git a/src/assets/plant_images/plant_15.png b/src/assets/plant_images/plant_15.png new file mode 100644 index 0000000000000000000000000000000000000000..8d60b130a5d7fcc0ed7065f8f0fe202143870174 --- /dev/null +++ b/src/assets/plant_images/plant_15.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1e41ba1fe2a3abdecb8506baf724560fac287649f58c729ba617b6bda29e221d +size 3147861 diff --git a/src/assets/plant_images/plant_16.png b/src/assets/plant_images/plant_16.png new file mode 100644 index 0000000000000000000000000000000000000000..643d67c7654e06bde7fe841393b46e4aadda9014 --- /dev/null +++ b/src/assets/plant_images/plant_16.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:741d14ef53e27eaee377b261621c683510b348a3ba86bc554fde69567c6c203a +size 3147861 diff --git a/src/assets/plant_images/plant_17.png b/src/assets/plant_images/plant_17.png new file mode 100644 index 0000000000000000000000000000000000000000..5ec4a83ca5c9d593ae9b5ff3fb55737d64468575 --- /dev/null +++ b/src/assets/plant_images/plant_17.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b591e0d5a13f7b0797e5e8d904ce3aceb3062bc7cf633e5e871a3f5b15e74532 +size 3147861 diff --git a/src/assets/plant_images/plant_18.png b/src/assets/plant_images/plant_18.png new file mode 100644 index 0000000000000000000000000000000000000000..0ed2f042bb6b95199247576c0a5482c37f624623 --- /dev/null +++ b/src/assets/plant_images/plant_18.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7512adccd41a9d5c5b33e675bf58fdde710ca93efb73d03d208d942d4ca45443 +size 3147861 diff --git a/src/assets/plant_images/plant_19.png b/src/assets/plant_images/plant_19.png new file mode 100644 index 0000000000000000000000000000000000000000..36e2612bc99ac1ee355df59b7960983ff0339dd1 --- /dev/null +++ b/src/assets/plant_images/plant_19.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a37a598786b9e492729d8a4e87b3ac64ffe7ab4e77dd820ff358b6e66b693074 +size 3147861 diff --git a/src/assets/plant_images/plant_2.png b/src/assets/plant_images/plant_2.png new file mode 100644 index 0000000000000000000000000000000000000000..b07202b5cb992531b61fca04c7ecd5aa21b4be5a --- /dev/null +++ b/src/assets/plant_images/plant_2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ad8f40579380d9f5a8ed77f849b2374e8ecea6ab5e4b093ef1c024d1c2b853dd +size 3147861 diff --git a/src/assets/plant_images/plant_20.png b/src/assets/plant_images/plant_20.png new file mode 100644 index 0000000000000000000000000000000000000000..755af01d57a4bd153c274a1c34d2d9cd80b813c9 --- /dev/null +++ b/src/assets/plant_images/plant_20.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6330a53ee13a6a5a107cc492176dd2b35b49858145747c0a5116c40cc7fc63df +size 3147861 diff --git a/src/assets/plant_images/plant_21.png b/src/assets/plant_images/plant_21.png new file mode 100644 index 0000000000000000000000000000000000000000..b451436eb086a114a7af79d1a31ed751d1c8d11c --- /dev/null +++ b/src/assets/plant_images/plant_21.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9ce45216230117227d55b83ee036ac0c8a8cab522e7fbcb9eb193f54f93e716d +size 3147861 diff --git a/src/assets/plant_images/plant_22.png b/src/assets/plant_images/plant_22.png new file mode 100644 index 0000000000000000000000000000000000000000..4236a5ef6a1e9a45aef71fe2a3e4285527f5764d --- /dev/null +++ b/src/assets/plant_images/plant_22.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4be3b613f9b2ce1ade9f91b63b49ba48a9bd7ba77f73b08cd0ed40c869493ded +size 3147861 diff --git a/src/assets/plant_images/plant_23.png b/src/assets/plant_images/plant_23.png new file mode 100644 index 0000000000000000000000000000000000000000..00254288fe9d56a256ef0102d997861ee28b9909 --- /dev/null +++ b/src/assets/plant_images/plant_23.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69f5607d685ef30a8b1a4e0e0beb4fe3a12e799ad62a21323a2a53fb0aa757e7 +size 3147861 diff --git a/src/assets/plant_images/plant_24.png b/src/assets/plant_images/plant_24.png new file mode 100644 index 0000000000000000000000000000000000000000..99f4bfceea506cf97b459e3c78ea26c15033233a --- /dev/null +++ b/src/assets/plant_images/plant_24.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98d710a088f6445bb1bcb4c71cdc723275c211dc26eda2f6915ee437cdbb07c4 +size 3147861 diff --git a/src/assets/plant_images/plant_25.png b/src/assets/plant_images/plant_25.png new file mode 100644 index 0000000000000000000000000000000000000000..171ef4b3d0a435e1d2dd1d0c03cff267683ad200 --- /dev/null +++ b/src/assets/plant_images/plant_25.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e68409d1c4cd72344c135e59b1ed2f89f5e2408cb7d8e2796c1f6273efd4f4d8 +size 3147861 diff --git a/src/assets/plant_images/plant_26.png b/src/assets/plant_images/plant_26.png new file mode 100644 index 0000000000000000000000000000000000000000..850481123c903609290ed6526e5b6387bb3e2e8d --- /dev/null +++ b/src/assets/plant_images/plant_26.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59c35f917f8fab0c38d8417248cf2744eac80a251b7a4f2b7be8bc3d4eace031 +size 3147861 diff --git a/src/assets/plant_images/plant_27.png b/src/assets/plant_images/plant_27.png new file mode 100644 index 0000000000000000000000000000000000000000..2c873671fe9751f686f2e87b29b250ebb296c9ed --- /dev/null +++ b/src/assets/plant_images/plant_27.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e6b7815a801cfa8586a6c3ad0b30dc7805da0f66bf82f503dd6b2a05e2da75cc +size 3147861 diff --git a/src/assets/plant_images/plant_28.png b/src/assets/plant_images/plant_28.png new file mode 100644 index 0000000000000000000000000000000000000000..18f4b15f7a6932937c499942d2e5e02a32e3c19b --- /dev/null +++ b/src/assets/plant_images/plant_28.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:84f8f0e55fb977677be929ee7ab0b3cb00cdf14eae80fbb0e8e619afd8d2f64b +size 3147861 diff --git a/src/assets/plant_images/plant_29.png b/src/assets/plant_images/plant_29.png new file mode 100644 index 0000000000000000000000000000000000000000..aa46dcf594aa478d3d462b8a73fb16024f816215 --- /dev/null +++ b/src/assets/plant_images/plant_29.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a9da6db9488b9f907cc1d6219a1484ebcc6d1301e7b34c8d45e15803579bdb71 +size 3147861 diff --git a/src/assets/plant_images/plant_3.png b/src/assets/plant_images/plant_3.png new file mode 100644 index 0000000000000000000000000000000000000000..ba0f51f62b2418bf41449bbcfe8ac840d63c3a64 --- /dev/null +++ b/src/assets/plant_images/plant_3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:28ef85229e00d9d0fab3e642b60d464cd400a66410f8ce4d0b9b3ebf216c03cf +size 3147861 diff --git a/src/assets/plant_images/plant_30.png b/src/assets/plant_images/plant_30.png new file mode 100644 index 0000000000000000000000000000000000000000..e61ad140f76ade6f57c9b46d13b3796fa15b2a75 --- /dev/null +++ b/src/assets/plant_images/plant_30.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:888232670d24d270c56c0d16818bd8661bb05f3ac6b86210a2f1870755fcbf51 +size 3147861 diff --git a/src/assets/plant_images/plant_31.png b/src/assets/plant_images/plant_31.png new file mode 100644 index 0000000000000000000000000000000000000000..ebeee999e31368f33ec603902af3332a301a68d0 --- /dev/null +++ b/src/assets/plant_images/plant_31.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:620124cff613840f22b16cd3004d763482b1d4f43c8f69b9eaef1bab42e65f90 +size 3147861 diff --git a/src/assets/plant_images/plant_32.png b/src/assets/plant_images/plant_32.png new file mode 100644 index 0000000000000000000000000000000000000000..ce190c0f638dc6f8e335ed5c475404e0bf924554 --- /dev/null +++ b/src/assets/plant_images/plant_32.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b68ec50fd3a60d1c9ee5dea42ad6a77e4266e0883d82164d12b65416f0caa050 +size 3147861 diff --git a/src/assets/plant_images/plant_33.png b/src/assets/plant_images/plant_33.png new file mode 100644 index 0000000000000000000000000000000000000000..ab3231182e20385fc53cee04a1a95320ab854a9e --- /dev/null +++ b/src/assets/plant_images/plant_33.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ca4ed06d91d408f33b1b3b58731f579ef2ce2391aac1fd3f032b3753deac6844 +size 3147861 diff --git a/src/assets/plant_images/plant_34.png b/src/assets/plant_images/plant_34.png new file mode 100644 index 0000000000000000000000000000000000000000..f5f1623aff777a426228ba9257c11aac3293d75a --- /dev/null +++ b/src/assets/plant_images/plant_34.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62acdc477c438b00fc79470bafacc5a1785ee3ba7933d7b7b5d1a9c7e8744f93 +size 3147861 diff --git a/src/assets/plant_images/plant_35.png b/src/assets/plant_images/plant_35.png new file mode 100644 index 0000000000000000000000000000000000000000..f5d31719e7405eda824303edc950dd17f10553ef --- /dev/null +++ b/src/assets/plant_images/plant_35.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:539105f32b5703894b7971bc67d6fd76e2fa69fef48451f2e99bf4b993b94d8b +size 3147861 diff --git a/src/assets/plant_images/plant_36.png b/src/assets/plant_images/plant_36.png new file mode 100644 index 0000000000000000000000000000000000000000..91a8db306591307f7d9e672d8039872b605643fc --- /dev/null +++ b/src/assets/plant_images/plant_36.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9dc97e6e65dc8a6941b9a5fd4abb41046736dd243bc1aa03a0ed0cda844c7f0a +size 3147861 diff --git a/src/assets/plant_images/plant_37.png b/src/assets/plant_images/plant_37.png new file mode 100644 index 0000000000000000000000000000000000000000..3eb3efd5b219b7f5cf02284f738077af45ca4842 --- /dev/null +++ b/src/assets/plant_images/plant_37.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4fc6d092df2fed571774691bdb72643cfb9be53e8b86bdd78f31756f60155efd +size 3147861 diff --git a/src/assets/plant_images/plant_38.png b/src/assets/plant_images/plant_38.png new file mode 100644 index 0000000000000000000000000000000000000000..ee6041f9f147d59de8c5c22267cfc2d34dda5e7e --- /dev/null +++ b/src/assets/plant_images/plant_38.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07c7b73a3db6b874e8bb2f5767b4f86e086c67d53b5424a764997bfe61ea039d +size 3147861 diff --git a/src/assets/plant_images/plant_39.png b/src/assets/plant_images/plant_39.png new file mode 100644 index 0000000000000000000000000000000000000000..7edcc50f12b7db7cefcd62b6a0b8040754a359b4 --- /dev/null +++ b/src/assets/plant_images/plant_39.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f7ccdde8a14626db08e0923949fb7d3ea23dcded1d0ff8eaa4e545d536da0f8 +size 3147861 diff --git a/src/assets/plant_images/plant_4.png b/src/assets/plant_images/plant_4.png new file mode 100644 index 0000000000000000000000000000000000000000..f9567f7b0a78f7163feb06c14efb1544dd871f40 --- /dev/null +++ b/src/assets/plant_images/plant_4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c396d53f91987fe487e94bac0770ad66a4da25531def050983547e0f00b27b00 +size 3147861 diff --git a/src/assets/plant_images/plant_40.png b/src/assets/plant_images/plant_40.png new file mode 100644 index 0000000000000000000000000000000000000000..c249d495fa236cb4242233d78c20834e410c6c79 --- /dev/null +++ b/src/assets/plant_images/plant_40.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9c4ea72ba787f6d44d7d789a97881ffc1b5d090f79687277a95d6f8e29629ac3 +size 3147861 diff --git a/src/assets/plant_images/plant_41.png b/src/assets/plant_images/plant_41.png new file mode 100644 index 0000000000000000000000000000000000000000..2db4242ccd6896ece1041bae8eed8214c84111f2 --- /dev/null +++ b/src/assets/plant_images/plant_41.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9d80f441a9ccb7384cf091593efd92ec5ce33a2e32b67d7089751457b406cf87 +size 3147861 diff --git a/src/assets/plant_images/plant_42.png b/src/assets/plant_images/plant_42.png new file mode 100644 index 0000000000000000000000000000000000000000..0bb482e83f213b667a3fcb440ad898ba82b90e0a --- /dev/null +++ b/src/assets/plant_images/plant_42.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b24877c124260e2add9447c7b3d5a2f68a69119ad060c3709915a946c4a12c26 +size 3147861 diff --git a/src/assets/plant_images/plant_43.png b/src/assets/plant_images/plant_43.png new file mode 100644 index 0000000000000000000000000000000000000000..1c63c8dc1fd28d617a808a183be91d75326e76cf --- /dev/null +++ b/src/assets/plant_images/plant_43.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cad00614cecbe0c40190c16bef6a202d933ec4378d77874b6ee9e3ae900403d1 +size 3147861 diff --git a/src/assets/plant_images/plant_44.png b/src/assets/plant_images/plant_44.png new file mode 100644 index 0000000000000000000000000000000000000000..decb8fc17d649733dbb47e988839647b590f9528 --- /dev/null +++ b/src/assets/plant_images/plant_44.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81d9da86024ce44e829070ce0122bb862e760b43ef2f33be1d4a517cbeafad42 +size 3147861 diff --git a/src/assets/plant_images/plant_45.png b/src/assets/plant_images/plant_45.png new file mode 100644 index 0000000000000000000000000000000000000000..0f4f22ad7630df335a3833e541ab9a3c9b75cceb --- /dev/null +++ b/src/assets/plant_images/plant_45.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b86c58f74ae6c3d01b652f3839a38a69218580b24d57bbed8c882d84947fcd3c +size 3147861 diff --git a/src/assets/plant_images/plant_46.png b/src/assets/plant_images/plant_46.png new file mode 100644 index 0000000000000000000000000000000000000000..15d27c9dbb43a21bbb3437346ca50a795f00ff5e --- /dev/null +++ b/src/assets/plant_images/plant_46.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:042f2c610cc8475de6025408268962a2e496078f7f3be44d07cc7dc58c646a6f +size 3147861 diff --git a/src/assets/plant_images/plant_47.png b/src/assets/plant_images/plant_47.png new file mode 100644 index 0000000000000000000000000000000000000000..ee87337366e52eb6a5581b549a492572e191f1fa --- /dev/null +++ b/src/assets/plant_images/plant_47.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:eea4cc19dfa9bacd168484856a08e0b7795cad5216366de08307255f2b6d17e3 +size 3147861 diff --git a/src/assets/plant_images/plant_48.png b/src/assets/plant_images/plant_48.png new file mode 100644 index 0000000000000000000000000000000000000000..dc87601da0177f391e6df8e7687ca3f76dedbcbb --- /dev/null +++ b/src/assets/plant_images/plant_48.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d49051a9ac5a573d4e20ff21244679514c0e544c64f50d0fb14bc792fed13fe9 +size 3147861 diff --git a/src/assets/plant_images/plant_49.png b/src/assets/plant_images/plant_49.png new file mode 100644 index 0000000000000000000000000000000000000000..d6f64b84ac05f19d44846d6ce3ecd7eb0b2e79bb --- /dev/null +++ b/src/assets/plant_images/plant_49.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9449584cb4d41f719581da470a67ff5b78023f0436c35eaf4f6ddd597bfee0d +size 3147861 diff --git a/src/assets/plant_images/plant_5.png b/src/assets/plant_images/plant_5.png new file mode 100644 index 0000000000000000000000000000000000000000..216d49d8b2383826f87c2725fd17dd1c1243c2b2 --- /dev/null +++ b/src/assets/plant_images/plant_5.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c063229f7341f40798dd433e62a9a0a1c0e4360ae839d78ddc19d9477a1f219 +size 3147861 diff --git a/src/assets/plant_images/plant_50.png b/src/assets/plant_images/plant_50.png new file mode 100644 index 0000000000000000000000000000000000000000..4d03baee2e72c8bdcdae385c8547bc3752b06c12 --- /dev/null +++ b/src/assets/plant_images/plant_50.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8a31938b8b2cc71023286c8113664af61b6727b2a040007f9197312b0812eb43 +size 3147861 diff --git a/src/assets/plant_images/plant_51.png b/src/assets/plant_images/plant_51.png new file mode 100644 index 0000000000000000000000000000000000000000..02ab16064313acb64590954ea6254491d87e5ffa --- /dev/null +++ b/src/assets/plant_images/plant_51.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:51710a068ab84713c92b637027d6565a1e6e79e0fc3adc49163647c1c0370f08 +size 3147861 diff --git a/src/assets/plant_images/plant_52.png b/src/assets/plant_images/plant_52.png new file mode 100644 index 0000000000000000000000000000000000000000..275cf9a11f6bf9669b90231625fde76d2da817ad --- /dev/null +++ b/src/assets/plant_images/plant_52.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1f7656c3ee60f942bd100906d797fb2ae6286b0637191000f98e779670f74b62 +size 3147861 diff --git a/src/assets/plant_images/plant_53.png b/src/assets/plant_images/plant_53.png new file mode 100644 index 0000000000000000000000000000000000000000..a842e439c4bbe36278d52955b080c47799c252d7 --- /dev/null +++ b/src/assets/plant_images/plant_53.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:07817c77174aa9023973dac3c2eec25b67cbefc6b805cf33692dc17468f46401 +size 3147861 diff --git a/src/assets/plant_images/plant_54.png b/src/assets/plant_images/plant_54.png new file mode 100644 index 0000000000000000000000000000000000000000..31e69a857eb074b77a6de34663d979aa78cf94f5 --- /dev/null +++ b/src/assets/plant_images/plant_54.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:268e864ec68a4ad4f7ebef22b863fcdb854c11da60c9f8fc5fee7a517e7f1b6a +size 3147861 diff --git a/src/assets/plant_images/plant_55.png b/src/assets/plant_images/plant_55.png new file mode 100644 index 0000000000000000000000000000000000000000..f038aa31f7f6d813055cef8d8512260855f24400 --- /dev/null +++ b/src/assets/plant_images/plant_55.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c194a9f08d78ea6b32fb5684c8c3a38bffdfe540c566e31cb380311d3c1f652b +size 3147861 diff --git a/src/assets/plant_images/plant_56.png b/src/assets/plant_images/plant_56.png new file mode 100644 index 0000000000000000000000000000000000000000..e9ad5d5046d24279bc3232ec892da082771d28eb --- /dev/null +++ b/src/assets/plant_images/plant_56.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d1d850e327fa1ee0e49e7a2a2b3459e72f6c80ad3c0158a4f5c6d78a54a44596 +size 3147861 diff --git a/src/assets/plant_images/plant_57.png b/src/assets/plant_images/plant_57.png new file mode 100644 index 0000000000000000000000000000000000000000..55634d109c1a7b5350613b40f4bb7c1ac9f49a77 --- /dev/null +++ b/src/assets/plant_images/plant_57.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:602104a81c4addf374662bfbed411c790f8b94fe3bf20849494b76679ff478d7 +size 3147861 diff --git a/src/assets/plant_images/plant_58.png b/src/assets/plant_images/plant_58.png new file mode 100644 index 0000000000000000000000000000000000000000..752ae8ee7a0fbeef79b99757bc386aff36c13a7b --- /dev/null +++ b/src/assets/plant_images/plant_58.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:57266347db1e36cb453038607a59b576e4fa9d7e1bb72291a5d1cb49887ea795 +size 3147861 diff --git a/src/assets/plant_images/plant_59.png b/src/assets/plant_images/plant_59.png new file mode 100644 index 0000000000000000000000000000000000000000..cf898277b9885c4cec5b6d97f9d6620a6cad16b2 --- /dev/null +++ b/src/assets/plant_images/plant_59.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:337c7b14faef520a2233012ea878a12c1b4736741124badd4c9788300dd37634 +size 3147861 diff --git a/src/assets/plant_images/plant_6.png b/src/assets/plant_images/plant_6.png new file mode 100644 index 0000000000000000000000000000000000000000..970ffa20f8bc1d96a431d3a8c7e5cd175e7d9b2c --- /dev/null +++ b/src/assets/plant_images/plant_6.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3e62068920d9be309e104e9d72c8da6a98c439f411210ac8b72ebcecb0a3237d +size 3147861 diff --git a/src/assets/plant_images/plant_60.png b/src/assets/plant_images/plant_60.png new file mode 100644 index 0000000000000000000000000000000000000000..515bae41b841c74fdc38753dee9dd7298d329d7a --- /dev/null +++ b/src/assets/plant_images/plant_60.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:507c433f04337d2d1377fcc74bcd8495dd3403f00046d1b472f7b9b0005ad255 +size 3147861 diff --git a/src/assets/plant_images/plant_61.png b/src/assets/plant_images/plant_61.png new file mode 100644 index 0000000000000000000000000000000000000000..13122875ccade93b5d6ed1b85a4329c6789d410c --- /dev/null +++ b/src/assets/plant_images/plant_61.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:467fb84b37d928ce73a646cc0ebfc33a4cc68d2870510d50767b0b61263200a8 +size 3147861 diff --git a/src/assets/plant_images/plant_62.png b/src/assets/plant_images/plant_62.png new file mode 100644 index 0000000000000000000000000000000000000000..65b2301c87d762fbec39795035da47c7e1829223 --- /dev/null +++ b/src/assets/plant_images/plant_62.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:086963b11a964dc365d9c53259be2348f95b2e88fc4ea84911a21b19c69bb4c2 +size 3147861 diff --git a/src/assets/plant_images/plant_63.png b/src/assets/plant_images/plant_63.png new file mode 100644 index 0000000000000000000000000000000000000000..bf37ed88835d4311d50eb7b8a73c980ca2644a3c --- /dev/null +++ b/src/assets/plant_images/plant_63.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f61c6088d75bb40cf298b416933020b2a675ded8951d63a1622652e67efcb4ff +size 3147861 diff --git a/src/assets/plant_images/plant_64.png b/src/assets/plant_images/plant_64.png new file mode 100644 index 0000000000000000000000000000000000000000..f628175bf66138a6c0c5bd2a47007e93bd77f543 --- /dev/null +++ b/src/assets/plant_images/plant_64.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f942f99b1cec4d6c1ca8c4cbb6178fd3f4d05a58f4ee79bd0bcaaae47fa4d30c +size 3147861 diff --git a/src/assets/plant_images/plant_65.png b/src/assets/plant_images/plant_65.png new file mode 100644 index 0000000000000000000000000000000000000000..ecdf699d0fe5c6daa3160ed1d78d2d68a3b4e589 --- /dev/null +++ b/src/assets/plant_images/plant_65.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a7babc02116278fbb61fdd93f58f515e4d35ce44c85fc5a82ec81dbea72f7f29 +size 3147861 diff --git a/src/assets/plant_images/plant_66.png b/src/assets/plant_images/plant_66.png new file mode 100644 index 0000000000000000000000000000000000000000..f060ac52938ed291ff3ba3a1aca2d1ecb2a15bce --- /dev/null +++ b/src/assets/plant_images/plant_66.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1ec81c0f1c4000cd921c158cbfdc75bf3bf22315dfb47bb4a6531556d9e1df4a +size 3147861 diff --git a/src/assets/plant_images/plant_67.png b/src/assets/plant_images/plant_67.png new file mode 100644 index 0000000000000000000000000000000000000000..68209b846f0a7a06effe5bcd0ec322fa0e434da3 --- /dev/null +++ b/src/assets/plant_images/plant_67.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c153155d72bf3cce65dc956e63e3656ff2bdb42c4ef77bf07d7b9c59ec198c47 +size 3147861 diff --git a/src/assets/plant_images/plant_7.png b/src/assets/plant_images/plant_7.png new file mode 100644 index 0000000000000000000000000000000000000000..8b030aee07092523cd8c98fa225b18c5d5206e56 --- /dev/null +++ b/src/assets/plant_images/plant_7.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0bbd52a92302459a96c0b7b4c442a5494462c4e56be7c6bfea31cf5b43c653e5 +size 3147861 diff --git a/src/assets/plant_images/plant_8.png b/src/assets/plant_images/plant_8.png new file mode 100644 index 0000000000000000000000000000000000000000..67928b2f1133511cfe1d92ca0c1f27e022f35f32 --- /dev/null +++ b/src/assets/plant_images/plant_8.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dab89f50d43aaf96aab06ef341bcf46e192dc900d07df78f07987e28cf96ffb0 +size 3147861 diff --git a/src/assets/plant_images/plant_9.png b/src/assets/plant_images/plant_9.png new file mode 100644 index 0000000000000000000000000000000000000000..5cfa5a0e65f78a3ffb430fbc5970a7c92ea49ac2 --- /dev/null +++ b/src/assets/plant_images/plant_9.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:40767ae0f67e5a72a402cb59f6afd22e45483af8753f37e91cb5f1a7af8884b4 +size 3147861 diff --git a/src/assets/readme1.png b/src/assets/readme1.png new file mode 100644 index 0000000000000000000000000000000000000000..ee7f8ed3eb89ddf658dee92fe512ff21a7d6a930 Binary files /dev/null and b/src/assets/readme1.png differ diff --git a/src/assets/readme2.png b/src/assets/readme2.png new file mode 100644 index 0000000000000000000000000000000000000000..52b8a840d119c7f8a5f384b8dd19f1bc5d9149f4 Binary files /dev/null and b/src/assets/readme2.png differ diff --git a/src/assets/readme3.png b/src/assets/readme3.png new file mode 100644 index 0000000000000000000000000000000000000000..ef104561e01e3f5a0928c7a37b0e4128bd2daeff Binary files /dev/null and b/src/assets/readme3.png differ diff --git a/src/assets/readme4.png b/src/assets/readme4.png new file mode 100644 index 0000000000000000000000000000000000000000..f682c5f12ebd5f22a2357b9abd54ed509d5769dd Binary files /dev/null and b/src/assets/readme4.png differ diff --git a/src/assets/readme5.png b/src/assets/readme5.png new file mode 100644 index 0000000000000000000000000000000000000000..856dce1d263e0a839a0ede3bb3f4b90abb5e7626 Binary files /dev/null and b/src/assets/readme5.png differ diff --git a/src/assets/score.png b/src/assets/score.png new file mode 100644 index 0000000000000000000000000000000000000000..ba4e3becd166e0b4fec62b7c61ead15075ddd217 Binary files /dev/null and b/src/assets/score.png differ diff --git a/src/assets/standing_flower.jpeg b/src/assets/standing_flower.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..94cf84511b46f0b3b0d741d79f5fbf6a9dc9c69a Binary files /dev/null and b/src/assets/standing_flower.jpeg differ diff --git a/src/backend/__pycache__/chatbot.cpython-310.pyc b/src/backend/__pycache__/chatbot.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..49b30226104a2d7949be231ba52e0e4a516034a0 Binary files /dev/null and b/src/backend/__pycache__/chatbot.cpython-310.pyc differ diff --git a/src/backend/__pycache__/chatbot.cpython-311.pyc b/src/backend/__pycache__/chatbot.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e93868544650d6b36923a6daf1857aff99711a9b Binary files /dev/null and b/src/backend/__pycache__/chatbot.cpython-311.pyc differ diff --git a/src/backend/__pycache__/optimization_algo.cpython-310.pyc b/src/backend/__pycache__/optimization_algo.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..4e20393ba85f308fd999e89700914f190cf23506 Binary files /dev/null and b/src/backend/__pycache__/optimization_algo.cpython-310.pyc differ diff --git a/src/backend/__pycache__/optimization_algo.cpython-311.pyc b/src/backend/__pycache__/optimization_algo.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..5a763e53d6ffd2300d763bfd78ab1ae8c9c7d988 Binary files /dev/null and b/src/backend/__pycache__/optimization_algo.cpython-311.pyc differ diff --git a/src/backend/chatbot.py b/src/backend/chatbot.py new file mode 100644 index 0000000000000000000000000000000000000000..4b2bd279d72fc74851cdde62da989d10fb8c25ce --- /dev/null +++ b/src/backend/chatbot.py @@ -0,0 +1,293 @@ +import streamlit as st +import pandas as pd +import os +from langchain.chat_models import ChatOpenAI +from langchain.prompts.chat import ( + ChatPromptTemplate, + SystemMessagePromptTemplate, + AIMessagePromptTemplate, + HumanMessagePromptTemplate, +) +from llama_index import ( + SimpleDirectoryReader, + VectorStoreIndex, + ServiceContext, +) +from llama_index.llms import LlamaCPP +from llama_index.llms.llama_utils import ( + messages_to_prompt, + completion_to_prompt, +) + + +# set model +# model = 'openai' +model = 'Llama2-7B_CPP' + +# initialize model +if model == 'Llama2-7B_CPP': + model_path = "/Users/dheym/Library/CloudStorage/OneDrive-Personal/Documents/side_projects/GRDN/src/models/llama-2-7b-chat.Q4_K_M.gguf" + llm = LlamaCPP( + # You can pass in the URL to a GGML model to download it automatically + #model_url=model_url, + # optionally, you can set the path to a pre-downloaded model instead of model_url + model_path=model_path, + temperature=0.1, + max_new_tokens=1000, + # llama2 has a context window of 4096 tokens, but we set it lower to allow for some wiggle room + context_window=3000, + # kwargs to pass to __call__() + generate_kwargs={}, + # kwargs to pass to __init__() + # set to at least 1 to use GPU + model_kwargs={"n_gpu_layers": 1}, + # transform inputs into Llama2 format + messages_to_prompt=messages_to_prompt, + completion_to_prompt=completion_to_prompt, + verbose=True, + ) + +def parse_and_evaluate_text(text): + # Find the indices of the opening and closing brackets + opening_bracket_index = text.find("[") + closing_bracket_index = text.find("]") + + if opening_bracket_index != -1 and closing_bracket_index != -1: + # Extract the text within the brackets + extracted_list = "[" + text[opening_bracket_index + 1: closing_bracket_index] + "]" + # Return the evaluated text list + return eval(extracted_list) + + + else: + print("Error with parsing plant list") + return None + +def chat_response(template, prompt_text, model): + if model == 'openai': + chat = ChatOpenAI(temperature=.1) + system_message_prompt = SystemMessagePromptTemplate.from_template(template) + human_template="{text}" + human_message_prompt = HumanMessagePromptTemplate.from_template(human_template) + chat_prompt = ChatPromptTemplate.from_messages([system_message_prompt, human_message_prompt]) + response = chat(chat_prompt.format_prompt(text= prompt_text).to_messages()) + return response + # return response.content + # elif model == 'Llama2-7B': + # llm = Replicate( + # model="a16z-infra/llama13b-v2-chat:df7690f1994d94e96ad9d568eac121aecf50684a0b0963b25a41cc40061269e5", + # temperature=0.1, + # #context_window=32, + # top_p=0.9, + # repetition_penalty=1.0, + # max_tokens=2000, + # #stop_sequences=["\n\n"], + # ) + # input_prompt = template + prompt_text + # print(input_prompt) + # resp = llm.complete(input_prompt) + # print(resp) + # return resp + elif model == 'Llama2-7B_CPP': + response = llm.complete(template + prompt_text) + return response.text + else: + print("Error with chatbot model") + return None + +# get the plant list from user input +def get_plant_list(input_plant_text): + template="You are a helpful assistant that knows all about gardening and plants and python data structures." + text = 'which of the elements of this list can be grown in a garden, [' + input_plant_text + ']? Return JUST a python list object containing the elements that can be grown in a garden. Do not include any other text or explanation.' + plant_list_text = chat_response(template, text, model) + plant_list = parse_and_evaluate_text(plant_list_text.content) + print(plant_list) + return plant_list + +# get plant care tips based on plant list +def get_plant_care_tips(plant_list): + plant_care_tips = "" + template="You are a helpful assistant that knows all about gardening, plants, and companion planting." + text = 'from this list of plants, [' + str(st.session_state.input_plants_raw) + '], generate a list of up to 10 plant care tips or interesting stories of plant compatibility for the plants in the list- maybe 1-2 per plant depending on what you know. Return just the plant care tips in HTML markdown format. Make sure to use ### for headers. Do not include any other text or explanation before or after the markdown. It must be in HTML markdown format.' + plant_care_tips = chat_response(template, text, model) + # check to see if response contains ### for headers + if "###" not in plant_care_tips: + print("Error with parsing plant care tips") + # try again up to 5 times + for i in range(5): + print("Error with parsing plant care tips. Trying for attempt #" + str(i+1)) + plant_care_tips = chat_response(template, text, model) + # check to see if response contains ### for headers + if "###" not in plant_care_tips: + continue + else: + break + # remove any text before the first ### in the response + plant_care_tips = "\n\n" + plant_care_tips[plant_care_tips.find("###"):] + + print(plant_care_tips) + return plant_care_tips + +# get compatability matrix for companion planting +def get_compatibility_matrix(plant_list): + # Convert the compatibility matrix to a string + with open('data/compatibilities_text.txt', 'r') as file: + # Read the contents of the file + compatibility_text = file.read() + plant_comp_context = compatibility_text + template="You are a helpful assistant that knows all about gardening, companion planting, and python data structures- specifically compatibility matrices." + text = 'from this list of plants, [' + str(plant_list) + '], Return JUST a python array (with values separated by commas like this: [[0,1],[1,0]]\n\n ) for companion plant compatibility. Each row and column should represent plants, and the element of the array will contain a -1, 0, or 1 depending on if the relationship between plants is antagonists, neutral, or companions, respectively. You must refer to this knowledge base of information on plant compatibility: \n\n, ' + plant_comp_context + '\n\n A plant\'s compatibility with itself is always 0. Do not include any other text or explanation.' + compatibility_mat = chat_response(template, text) + + + + + # Find the indices of the opening and closing brackets + opening_bracket_index = compatibility_mat.content.find("[[") + closing_bracket_index = compatibility_mat.content.find("]]") + if opening_bracket_index != -1 and closing_bracket_index != -1: + # Extract the text within the brackets + extracted_mat = "[" + compatibility_mat.content[opening_bracket_index + 1: closing_bracket_index] + "]]" + # Return the evaluated mat + # check to see if compatiblity matrix only contains values of -1, 0, or 1 + if eval(extracted_mat).count('0') + eval(extracted_mat).count('1') == len(eval(extracted_mat)): + # continue + pass + else: + # try again up to 5 times + for i in range(5): + print("Error with parsing plant compatibility matrix. Trying for attempt #" + str(i+1)) + print(extracted_mat) + extracted_mat = chat_response(template + "remember, it MUST ONLY CONTAIN -1s, 0s, and 1s, like this structure: [[0,1],[1,0]]", text) + # Extract the text within the brackets + extracted_mat = "[" + compatibility_mat.content[opening_bracket_index + 1: closing_bracket_index] + "]]" + print(extracted_mat) + total_count = 0 + count_0 = extracted_mat.count("0") + count_1 = extracted_mat.count("1") + total_count = count_0 + count_1 + print("matrix count of -1, 0, 1: ", total_count) + # if count euals the number of plants squared, then we have a valid matrix + print("plant_list_len: ", len(plant_list)**2) + if total_count == (len(plant_list))**2: + #if count == eval(extracted_mat): + print("success") + return eval(extracted_mat) + break + + + else: + print("Error with parsing plant compatibility matrix") + # try again up to 5 times + for i in range(5): + print("Error with parsing plant compatibility matrix. Trying for attempt #" + str(i+1)) + extracted_mat = chat_response(template + "remember, it MUST ONLY CONTAIN -1s, 0s, and 1s, like this structure: [[0,1],[1,0]]", text) + # Extract the text within the brackets + extracted_mat = "[" + compatibility_mat.content[opening_bracket_index + 1: closing_bracket_index] + "]]" + print(extracted_mat) + total_count = 0 + count_0 = extracted_mat.count("0") + count_1 = extracted_mat.count("1") + total_count = count_0 + count_1 + print("matrix count of -1, 0, 1: ", total_count) + # if count euals the number of plants squared, then we have a valid matrix + print("plant_list_len: ", len(plant_list)**2) + if total_count == (len(plant_list))**2: + #if count == eval(extracted_mat): + print("success") + return eval(extracted_mat) + break + + return None + +# get compatability matrix for companion planting via subsetting a hardcoded matrix +# make plant_compatibility.csv into a matrix. it currently has indexes as rows and columns for plant names and then compatibility values as the values +plant_compatibility = pd.read_csv('src/data/plant_compatibility.csv', index_col=0) + +def get_compatibility_matrix_2(plant_list): + + # Subset the matrix to only include the plants in the user's list + plant_compatibility = st.session_state.raw_plant_compatibility.loc[plant_list, plant_list] + + # full matrix + full_mat = st.session_state.raw_plant_compatibility.to_numpy() + + # Convert the DataFrame to a NumPy array + plant_compatibility_matrix = plant_compatibility.to_numpy() + + # Get the list of original indices (from the DataFrame) + original_indices = plant_compatibility.index.tolist() + + # Create a dictionary to map plant names to their original indices + plant_index_mapping = {plant: index for index, plant in enumerate(original_indices)} + + # Return the matrix and the plant-index mapping + return plant_compatibility_matrix, full_mat, plant_index_mapping + +# get plant groupings from LLM +def get_seed_groupings_from_LLM(): + plant_groupings_evaluated = "no response yet" + template="You are a helpful assistant that only outputs python lists of lists of lists of plants." + # make sure output is strictly and only a list of lists for one grouping + text ='''I am working on a gardening project and need to optimally group a set of plants based on their compatibility. Below is the compatibility matrix for the plants, where each value represents how well two plants grow together (positive values indicate good compatibility, negative values indicate poor compatibility). I also have specific constraints for planting: there are a certain number of plant beds (n_plant_beds), each bed can have a minimum of min_species species and a maximum of max_species species. Given these constraints, please suggest several groupings of these plants into n_plant_beds beds, optimizing for overall compatibility. + + Number of Plant Beds: ''' + str(st.session_state.n_plant_beds) + ''' + Minimum Species per Bed: ''' + str(st.session_state.min_species) + ''' + Maximum Species per Bed: ''' + str(st.session_state.max_species) + ''' + Plants and Compatibility Matrix:'''+ str(st.session_state.raw_plant_compatibility.loc[st.session_state.input_plants_raw, st.session_state.input_plants_raw]) + ''' + + Please provide a grouping that maximize positive interactions within each bed and minimize negative interactions, adhering to the specified bed constraints. Return a list of lists where each list represents an iteration of plant groupings. Each list within the list represents a bed, and each list within the bed represents the plants in that bed. + sample output: [['plant1', 'plant2'] #bed1, ['plant3', 'plant4'] #bed2, ['plant1', 'plant3'] #bed3] + another sample output: [['plant1', 'plant2', 'plant3'] #bed1, ['plant4', 'plant5', 'plant6'] #bed2, ['plant7', 'plant8', 'plant9'] #bed3] + Note: the number of beds, the number of plants per bed, and the number of plants in the list may vary. + Note: only output ONE python list of lists of plants. Do not include any other text or explanation. + + ''' + + + plant_groupings = chat_response(template, text, model) + print('response about LLMs choice on groupings', plant_groupings) + + # try to eval the string to a list of lists + try: + plant_groupings_evaluated = eval(plant_groupings) + # check type of output + print(type(plant_groupings_evaluated)) + # we expect a list of lists + except: + print("Error with parsing plant groupings") + # try again up to 5 times + for i in range(5): + print("Error with parsing plant groupings. Trying for attempt #" + str(i+1)) + plant_groupings = chat_response(template, text, model) + print(plant_groupings) + # try to eval the string to a list of lists + try: + # make sure plant1 is not in the output + if 'plant1' in plant_groupings: + print("plant1 is in the output") + continue + else: + plant_groupings_evaluated = eval(plant_groupings) + print("successful eval; output: ", plant_groupings_evaluated) + break + except: + # try to find the list of lists within the string + opening_bracket_index = plant_groupings.find("[[") + closing_bracket_index = plant_groupings.find("]]") + if opening_bracket_index != -1 and closing_bracket_index != -1: + # Extract the text within the brackets + extracted_list = "[" + plant_groupings[opening_bracket_index + 1: closing_bracket_index] + "]]" + # Return the evaluated text list + if 'plant1' in extracted_list: + print("plant1 is in the output") + continue + else: + plant_groupings_evaluated = eval(extracted_list) + print("successful eval; output: ", plant_groupings_evaluated) + break + else: + print("Error with parsing plant groupings") + continue + + return plant_groupings_evaluated diff --git a/src/backend/optimization_algo.py b/src/backend/optimization_algo.py new file mode 100644 index 0000000000000000000000000000000000000000..cdcfc37c663eae6e1bd6ff9df35d27301dc4b7f1 --- /dev/null +++ b/src/backend/optimization_algo.py @@ -0,0 +1,309 @@ +import random +import numpy as np +import streamlit as st + +# import all functions from src.backend.chatbot +from src.backend.chatbot import * + +def genetic_algorithm_plants(): + # Define the compatibility matrix + compatibility_matrix = st.session_state.full_mat + # Define the list of plants + plant_list = st.session_state.plant_list + + # Define the user-selected plants, number of plant beds, and constraints + user_plants = st.session_state.input_plants_raw + num_plant_beds = st.session_state.n_plant_beds + # 1 <= min_species_per_bed <= max_species_per_bed <= len(user_plants) + min_species_per_bed = st.session_state.min_species + # max_species_per_bed >= floor(length(user_plants)-(min_species_per_bed*num_plant_beds-1) & max_species_per_bed <= len(user_plants) + max_species_per_bed = st.session_state.max_species + + + # Genetic Algorithm parameters + population_size = st.session_state.population_size + num_generations = st.session_state.num_generations + tournament_size = st.session_state.tournament_size + crossover_rate = st.session_state.crossover_rate + mutation_rate = st.session_state.mutation_rate + seed_population_rate = st.session_state.seed_population_rate + + + def generate_initial_population(): + population = [] + + # Add seed groupings to the population, validated and replaced as necessary + num_seeds = int(population_size * st.session_state.seed_population_rate) # 10% of the population as seeds + # we generate just one seed grouping for this beta language model suggestion feature + seed_grouping = get_language_model_suggestions() + if seed_grouping != "no response yet": + valid_seed_grouping = validate_and_replace(seed_grouping) + population.append(valid_seed_grouping) + + + # Fill the rest of the population with random groupings, also validated and replaced + while len(population) < population_size: + random_grouping = generate_random_grouping() + valid_random_grouping = validate_and_replace(random_grouping) + population.append(valid_random_grouping) + + return population + + + def generate_random_grouping(): + random.shuffle(user_plants) + remaining_plants = user_plants.copy() + grouping = [] + + total_plants = len(user_plants) + plants_per_bed = total_plants // num_plant_beds + extra_plants = total_plants % num_plant_beds + + for bed_index in range(num_plant_beds): + if bed_index < extra_plants: + # Distribute extra plants among the first few beds + num_species_in_bed = plants_per_bed + 1 + else: + num_species_in_bed = plants_per_bed + + # Ensure the bed size is within the min and max constraints + num_species_in_bed = max(min_species_per_bed, min(num_species_in_bed, max_species_per_bed)) + + bed = remaining_plants[:num_species_in_bed] + remaining_plants = remaining_plants[num_species_in_bed:] + grouping.append(bed) + + return grouping + + + + # Perform crossover between two parents, preserving at least one occurrence of each plant + def crossover(parent1, parent2): + if random.random() < crossover_rate: + crossover_point = random.randint(1, num_plant_beds - 1) + child1 = parent1[:crossover_point] + parent2[crossover_point:] + child2 = parent2[:crossover_point] + parent1[crossover_point:] + + # Ensure each plant appears at least once in the offspring + for plant in user_plants: + if all(plant not in bed for bed in child1): + # Find a bed with fewer species and add the missing plant + min_bed_index = min(range(len(child1)), key=lambda i: len(child1[i])) + child1[min_bed_index].append(plant) + if all(plant not in bed for bed in child2): + # Find a bed with fewer species and add the missing plant + min_bed_index = min(range(len(child2)), key=lambda i: len(child2[i])) + child2[min_bed_index].append(plant) + + return child1, child2 + else: + return parent1, parent2 + + # Perform mutation on an individual, ensuring no bed exceeds the maximum species constraint + def mutate(individual): + if random.random() < mutation_rate: + mutated_bed = random.randint(0, num_plant_beds - 1) + species_in_bed = individual[mutated_bed] + + # Remove excess species if there are more than the maximum constraint + if len(species_in_bed) > max_species_per_bed: + species_in_bed = random.sample(species_in_bed, max_species_per_bed) + + # Add missing plants by performing swaps between current species and missing plants + missing_plants = [plant for plant in user_plants if plant not in species_in_bed] + num_missing_plants = min(len(missing_plants), max_species_per_bed - len(species_in_bed)) + for _ in range(num_missing_plants): + swap_species = random.choice(missing_plants) + missing_plants.remove(swap_species) + species_in_bed.append(swap_species) + species_in_bed.remove(random.choice(species_in_bed)) + + individual[mutated_bed] = species_in_bed + + return individual + + # Calculate the fitness score of the grouping + def calculate_fitness(grouping): + positive_reward_factor = 1000 # Adjust this to increase the reward for compatible species + negative_penalty_factor = 2000 # Adjust this to increase the penalty for incompatible species + + # Define penalties for not meeting constraints + penalty_for_exceeding_max = 500 # Adjust as needed + penalty_for_not_meeting_min = 500 # Adjust as needed + penalty_for_not_having_all_plants = 1000 # Adjust as needed + + score = 0 + # Iterate over each plant bed + for bed in grouping: + for i in range(len(bed)): + for j in range(i + 1, len(bed)): + # get the plant name + species1_name = bed[i] + species2_name = bed[j] + species1_index = plant_list.index(species1_name) + species2_index = plant_list.index(species2_name) + + # Compatibility score between two species in the same bed + compatibility_score = compatibility_matrix[species1_index][species2_index] + + if compatibility_score > 0: + # Positive reward for compatible species + score += compatibility_score*positive_reward_factor + elif compatibility_score < 0: + # Negative penalty for incompatible species + score += compatibility_score*negative_penalty_factor + + + # Apply penalties for not meeting constraints + if len(bed) > max_species_per_bed: + score -= penalty_for_exceeding_max + if len(bed) < min_species_per_bed: + score -= penalty_for_not_meeting_min + if len(set(plant for bed in grouping for plant in bed)) < len(user_plants): + score -= penalty_for_not_having_all_plants + + return score + + + # Perform tournament selection + def tournament_selection(population): + selected = [] + for _ in range(population_size): + participants = random.sample(population, tournament_size) + winner = max(participants, key=calculate_fitness) + selected.append(winner) + return selected + + # Perform replacement of the population with the offspring, ensuring maximum species constraint is met + def replacement(population, offspring): + sorted_population = sorted(population, key=calculate_fitness, reverse=True) + sorted_offspring = sorted(offspring, key=calculate_fitness, reverse=True) + + # Adjust the offspring to meet the maximum species constraint + adjusted_offspring = [] + for individual in sorted_offspring: + for bed_idx in range(num_plant_beds): + species_in_bed = individual[bed_idx] + if len(species_in_bed) > max_species_per_bed: + species_in_bed = random.sample(species_in_bed, max_species_per_bed) + individual[bed_idx] = species_in_bed + adjusted_offspring.append(individual) + + return sorted_population[:population_size - len(adjusted_offspring)] + adjusted_offspring + + # Genetic Algorithm main function + def genetic_algorithm(): + population = generate_initial_population() + + for generation in range(num_generations): + print(f"Generation {generation + 1}") + + selected_population = tournament_selection(population) + offspring = [] + + for _ in range(population_size // 2): + parent1 = random.choice(selected_population) + parent2 = random.choice(selected_population) + child1, child2 = crossover(parent1, parent2) + child1 = mutate(child1) + child2 = mutate(child2) + offspring.extend([child1, child2]) + + population = replacement(population, offspring) + # Validate and replace any missing plants in the new population + population = [validate_and_replace(grouping) for grouping in population] + + + best_grouping = max(population, key=calculate_fitness) + best_grouping = validate_and_replace(best_grouping) + best_fitness = calculate_fitness(best_grouping) + print(f"Best Grouping: {best_grouping}") + print(f"Fitness Score: {best_fitness}") + st.session_state.best_grouping = best_grouping + st.session_state.best_fitness = best_fitness + # st.write(f"Best Grouping: {best_grouping}") + # st.write(f"Fitness Score: {best_fitness}") + return best_grouping + + # def validate_and_replace(grouping): + # print("Grouping structure before validation:", grouping) + # all_plants = set(user_plants) + # for bed in grouping: + # all_plants -= set(bed) + + # # Replace missing plants + # for missing_plant in all_plants: + # replaced = False + # for bed in grouping: + # if len(set(bed)) != len(bed): # Check for duplicates + # for i, plant in enumerate(bed): + # if bed.count(plant) > 1: # Found a duplicate + # bed[i] = missing_plant + # replaced = True + # break + # if replaced: + # break + + # # If no duplicates were found, replace a random plant + # if not replaced: + # random_bed = random.choice(grouping) + # random_bed[random.randint(0, len(random_bed) - 1)] = missing_plant + + # return grouping + + ############ + ############ experimental + + def adjust_grouping(grouping): + # Determine the plants that are missing in the grouping + plants_in_grouping = set(plant for bed in grouping for plant in bed) + missing_plants = set(user_plants) - plants_in_grouping + + for missing_plant in missing_plants: + # Find a bed that can accommodate the missing plant without exceeding max_species_per_bed + suitable_bed = next((bed for bed in grouping if len(bed) < max_species_per_bed), None) + if suitable_bed is not None: + suitable_bed.append(missing_plant) + else: + # If no suitable bed is found, replace a random plant in a random bed + random_bed = random.choice(grouping) + random_bed[random.randint(0, len(random_bed) - 1)] = missing_plant + + # Ensure min_species_per_bed and max_species_per_bed constraints + for bed in grouping: + while len(bed) < min_species_per_bed: + additional_plant = random.choice([plant for plant in user_plants if plant not in bed]) + bed.append(additional_plant) + while len(bed) > max_species_per_bed: + bed.remove(random.choice(bed)) + + return grouping + + def validate_and_replace(grouping): + best_grouping = None + best_fitness = float('-inf') + + for _ in range(5): # Generate 5 different configurations + temp_grouping = [bed.copy() for bed in grouping] + temp_grouping = adjust_grouping(temp_grouping) + current_fitness = calculate_fitness(temp_grouping) + + if current_fitness > best_fitness: + best_fitness = current_fitness + best_grouping = temp_grouping + + return best_grouping + + + + ############ + def get_language_model_suggestions(): + # Placeholder for your implementation + # This should return a list of seed groupings based on the compatibility matrix + st.session_state.seed_groupings = get_seed_groupings_from_LLM() + return st.session_state.seed_groupings + + + + best_grouping = genetic_algorithm() + return best_grouping \ No newline at end of file diff --git a/src/backend/preprocessing_image_gen.ipynb b/src/backend/preprocessing_image_gen.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..cbf0bdf686996fda0159dd47a53a08ef50206392 --- /dev/null +++ b/src/backend/preprocessing_image_gen.ipynb @@ -0,0 +1,169 @@ +{ + "cells": [ + { + "attachments": {}, + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# A scratch pad notebook for testing out ideas" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "# import libraries\n", + "import os\n", + "import pandas as pd\n", + "import numpy as np" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['Apricot', 'Apple', 'Asparagus', 'Basil', 'Beans', 'Broad Beans', 'Bush Beans', 'Climbing Beans', 'Beets', 'Borage', 'Broccoli', 'Brussel Sprouts', 'Cabbages', 'Chamomile', 'Carrots', 'Cauliflower', 'Celery', 'Cherry', 'Chervil', 'Chives', 'Coriander', 'Corn', 'Cucumber', 'Dill', 'Eggplant', 'Fennel', 'Marigold', 'Fruit Trees', 'Garlic', 'Gooseberry', 'Grape Vine', 'Grass', 'Horseradish', 'Lavendar', 'Leeks', 'Lemon Balm', 'Lettuce', 'Marjoram', 'Mints', 'Mulberry', 'Mustard', 'Nasturtiums', 'Onions', 'Parsley', 'Parsnip', 'Peas', 'Pennyroyal', 'Potato', 'Pumpkin', 'Radish', 'Raspberry', 'Rosemary', 'Roses', 'Rue', 'Sage', 'Savory', 'Shallots', 'Silverbeet', 'Spinach', 'Squash', 'Strawberries', 'Stinging Nettle', 'Sunflower', 'Tansy', 'Thyme', 'Tomato', 'Yarrow', 'Zucchini']\n" + ] + } + ], + "source": [ + "# make plant_compatibility.csv into a matrix. it currently has indexes as rows and columns for plant names and then compatibility values as the values\n", + "plant_compatibility = pd.read_csv('../data/plant_compatibility.csv', index_col=0)\n", + "\n", + "# fill NaN values with 0\n", + "plant_compatibility = plant_compatibility.fillna(0)\n", + "\n", + "# get list of plants\n", + "plant_list = plant_compatibility.index.tolist()\n", + "print(plant_list)" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "https://oaidalleapiprodscus.blob.core.windows.net/private/org-5YS2GMCG8RfgP4OEokQn3hGg/user-6uCRR8MZKqJD3U6peXi7IE82/img-17pR4xJgtkBs5Gx5Kx48xElA.png?st=2023-12-17T18%3A20%3A53Z&se=2023-12-17T20%3A20%3A53Z&sp=r&sv=2021-08-06&sr=b&rscd=inline&rsct=image/png&skoid=6aaadede-4fb3-4698-a8f6-684d7786b067&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2023-12-16T19%3A51%3A17Z&ske=2023-12-17T19%3A51%3A17Z&sks=b&skv=2021-08-06&sig=6TrxNFh%2BsgPEMxqnNRc6qYagOGmEWbISLKW3wMKFosw%3D\n", + "https://oaidalleapiprodscus.blob.core.windows.net/private/org-5YS2GMCG8RfgP4OEokQn3hGg/user-6uCRR8MZKqJD3U6peXi7IE82/img-vqmQfv9IUlKzR08WzaniBpzs.png?st=2023-12-17T18%3A21%3A04Z&se=2023-12-17T20%3A21%3A04Z&sp=r&sv=2021-08-06&sr=b&rscd=inline&rsct=image/png&skoid=6aaadede-4fb3-4698-a8f6-684d7786b067&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2023-12-17T19%3A11%3A33Z&ske=2023-12-18T19%3A11%3A33Z&sks=b&skv=2021-08-06&sig=dqymS6fNQkfntMPb31owYanMCfHwRcTnHMC7qc1OISI%3D\n" + ] + } + ], + "source": [ + "\n", + "import openai\n", + "import requests\n", + "\n", + "# setup keys and api info\n", + "file_path = '/Users/dheym/Library/CloudStorage/OneDrive-Personal/Documents/side_projects/api_keys/openai_api_keys.txt'\n", + "with open(file_path, 'r') as file:\n", + " OPENAI_API_KEY = file.read()\n", + "\n", + "os.environ[\"OPENAI_API_KEY\"] = OPENAI_API_KEY\n", + "\n", + "# setup openai\n", + "openai.api_key = os.getenv(\"OPENAI_API_KEY\")\n", + "\n", + "from openai import OpenAI\n", + "client = OpenAI()\n", + "\n", + "\n", + "\n", + "# call Dalle3 to generate images for each plant and save them in the assets folder. use the filename plant_x.png where x is the index of the plant in the plant_list.\n", + "#for i in range(45,len(plant_list)):\n", + "# edit 46, 48, 49, 51, 52, 53, 54, 55, 63 \n", + "for i in [46, 52]:\n", + "# 46, 48, 49, 51, 52, 53, 54, 55, 63 \n", + " plant_name = plant_list[i]\n", + " response = client.images.generate(\n", + " model=\"dall-e-3\",\n", + " prompt=\"a high quality color pixel image (think videogame) of \" + plant_name + \" (as in produce or the plant) with a solid black background. no other objects in the image.\",\n", + " size=\"1024x1024\",\n", + " quality=\"standard\",\n", + " n=1,\n", + " )\n", + "\n", + " # Get the image URL from the response\n", + " image_url = response.data[0].url\n", + " print(image_url)\n", + " \n", + " # Download the image\n", + " img_data = requests.get(image_url).content\n", + "\n", + " # Save the image in the assets folder with the specified filename\n", + " with open(f'../assets/plant_images/plant_{i}.png', 'wb') as handler:\n", + " handler.write(img_data)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['Apricot', 'Apple', 'Asparagus', 'Basil', 'Beans', 'Broad Beans',\n", + " 'Bush Beans', 'Climbing Beans', 'Beets', 'Borage', 'Broccoli',\n", + " 'Brussel Sprouts', 'Cabbages', 'Chamomile', 'Carrots', 'Cauliflower',\n", + " 'Celery', 'Cherry', 'Chervil', 'Chives', 'Coriander', 'Corn',\n", + " 'Cucumber', 'Dill', 'Eggplant', 'Fennel', 'Marigold', 'Fruit Trees',\n", + " 'Garlic', 'Gooseberry', 'Grape Vine', 'Grass', 'Horseradish',\n", + " 'Lavendar', 'Leeks', 'Lemon Balm', 'Lettuce', 'Marjoram', 'Mints',\n", + " 'Mulberry', 'Mustard', 'Nasturtiums', 'Onions', 'Parsley', 'Parsnip',\n", + " 'Peas', 'Pennyroyal', 'Potato', 'Pumpkin', 'Radish', 'Raspberry',\n", + " 'Rosemary', 'Roses', 'Rue', 'Sage', 'Savory', 'Shallots', 'Silverbeet',\n", + " 'Spinach', 'Squash', 'Strawberries', 'Stinging Nettle', 'Sunflower',\n", + " 'Tansy', 'Thyme', 'Tomato', 'Yarrow', 'Zucchini'],\n", + " dtype='object')" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "\n", + "\n", + "\n", + "plant_compatibility.columns.tolist()\n", + "# call Dalle3 to generate images for each plant and save them in the assets folder. use the filename plant_x.png where x is the index of the plant in the plant_list.\n", + "# for i in range(len(plant_list)):\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "GRDN_env", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.3" + }, + "orig_nbformat": 4 + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/src/data/compatibilities_text.txt b/src/data/compatibilities_text.txt new file mode 100644 index 0000000000000000000000000000000000000000..9648dfec015444b8bf964d16f1a6edf50bd71d56 --- /dev/null +++ b/src/data/compatibilities_text.txt @@ -0,0 +1,938 @@ +Apple Companions:[ +Marigolds +Garlic +Lemon Balm +Chives +Leeks +Nasturtium +Clover +Daffodils +Comfrey] +Apple Antagonists:[ +Grass +Potato +Walnut] + +Apricot Companions:[ +Basil +Nasturtiums +Sunflower] +Apricot Antagonists:[ +Grass +Tomato +Peppers] + +Asparagus Companions:[ +Basil +Parsley +Tomato +Dill +Coriander +Comfrey +Nasturtiums] +Asparagus Antagonists:[ +Onion +Potato +Gladiolas +Garlic] + +Basil Companions:[ +Chamomile +Anise +Tomato +Pepper +Oregano +Asparagus +Grape Vine +Petunias] +Basil Antagonists:[ +Rue] + +Bean Companions:[ +Beets +Cucumbers +Carrots +Lettuce +Okra +Potato +Spinach +Dill +Cabbage +Chard +Eggplant +Peas +Broccoli +Cauliflower +Corn +Grape Vine +Savory +Borage +Marigold +Radish +Mint +Rosemary +Onion +Squash] +Bean Antagonists:[ +Tomatoes +Peppers +Alliums] + +Broad Bean Companions:[ +Cabbage +Corn +Lettuce] +Broad Bean Antagonists:[ +Garlic +Onion +Chive +Shallot +Fennel +Sunflowers] + +Bush Bean Companions:[ +Celery +Strawberry +Cucumber +Soybeans +Grains +Beets +Cabbage +Carrot +Cauliflower +Corn +Marigolds +Potato +Savory] +Bush Bean Antagonists:[ +Soybean +Alfalfa +Fennel +Garlic +Leeks +Onion +Shallot] + +Climbing Bean Companions:[ +Cabbage +Corn +Radish +Marigold +Potato] +Climbing Bean Antagonists:[ +Beet +Sunflower +Fennel +Broccoli +Cauliflower +Kohlrabi +Garlic +Onion +Shallot +Leeks] + +Beet Companions:[ +Lettuce +Garlic +Kohlrabi +Onion +Shallot +Broccoli +Cauliflower +Brussels Sprouts +Beans (bush) +Swiss Chard +Cabbage +Mint] +Beet Antagonists:[ +Climbing Beans +Tomato +Mustard] + +Borage Companions:[ +Strawberry +Tomato +Squash +Beans (all) +Cucumber +Fruit Trees +Cabbage] +Borage Antagonists:[ +None] + +Broccoli Companions:[ +Beet +Lettuce +Turnip +Dill +Mustard +Onion +Tomato +Chamomile +Carrot +Marigold +Mint +Nasturtiums +Rosemary +Thyme +Sage] +Broccoli Antagonists:[ +Strawberry +Peppers +Climbing Beans] + + +Brussels Sprout Companions:[ +Sage +Thyme +Beans (all) +Beets +Carrot +Chamomile +Dill +Marigolds +Mint +Onion +Nasturtiums +Rosemary +Brussels Sprout Antagonists:[ +Strawberries] + +Cabbage Companions:[ +Beans (all) +Chamomile +Tomato +Celery +Marigolds +Nasturtiums +Dill +Coriander +Onion +Beets +Mint +Rosemary +Sage +Thyme +Lettuce +Garlic +Broccoli +Brussels Sprouts +Swiss Chard +Spinach] +Cabbage Antagonists:[ +Grape Vine +Rue +Strawberry] + +Cantaloupe Companions:[ +Chamomile +Savory +Corn] +Cantaloupe Antagonists:[ +None] + +Chamomile Companions:[ +Cauliflower +Broccoli +Onion +Cabbage +Cucumber +Most Herbs] +Chamomile Antagonists:[ +Mint] + +Carrot Companions:[ +Rosemary +Onion +Lettuce +Garlic +Shallot +Chive +Tomato +Beans (all) +Leek +Rosemary +Sage +Peas] +Carrot Antagonists:[ +Dill +Parsnip +Radish] + +Cauliflower Companions:[ +Spinach +Sunflower +Peas +Beans (all) +Broccoli +Celery +Marigold +Cabbage +Swiss Chard +Tomato +Brussels Sprouts] +Cauliflower Antagonists:[ +Rue +Strawberry] + +Celery Companions:[ +Tomato +Bush Beans +Cauliflower +Broccoli +Cauliflower +Cabbage] +Celery Antagonists:[ +Corn +Potato +Parsnip] + +Cherry Companions:[ +Alliums +Marigold +Spinach] +Cherry Antagonists:[ +Grass +Potato] + +Chervil Companions:[ +Broccoli +Lettuce +Radish] +Chervil Antagonists:[ +None] + +Chive Companions:[ +Apple +Carrot +Rose +Grape Vine +Tomato +Broccoli +Cabbage +Mustard +Cauliflower +Strawberry] +Chive Antagonists:[ +Beans (all) +Peas] + +Coriander Companions:[ +Cabbage +Spinach +Lettuce +Tomato +Anise +Beans (all) +Peas] +Coriander Antagonists:[ +Dill] + +Corn Companions:[ +Squash +Climbing Beans +Potato +Soybeans +Cucumber +Sunflower +Dill +Peas +Parsley +Potato +Mustard +Pumpkin +Melons] +Corn Antagonists:[ +Tomato +Celery] + +Cucumber Companions:[ +Kohlrabi +Radish +Sunflower +Beans (all) +Lettuce +Nasturtiums +Chamomile +Marigold +Peas +Beets +Carrot +Dill +Onion +Garlic +Celery +Spinach +Corn +Cabbage] +Cucumber Antagonists:[ +Potato +Sage and many other herbs] + +Dill Companions:[ +Broccoli +Cabbage +Fennel +Beans (all) +Corn +Radish +Sunflower +Lettuce +Onion +Eggplant +Cucumber] +Dill Antagonists:[ +Coriander +Carrot +Tomato] + +Fennel Companions:[ +Dill +Eggplant +Basil] +Fennel Antagonists:[ +Tomato +Coriander +Beans (most)] + +Marigold Companions:[ +Most Plants +Tomato +Pepper +Apricot +Beans (all) +Rose +Cucumber +Squash +Potato +Zucchini +Broccoli +Cauliflower +Cabbage +Onion +Garlic +Chive +Shallot] +Marigold Antagonists:[ +None] + +Fruit Tree Companions:[ +Onion +Borage +Nasturtiums +Garlic +Chive +Shallot +Tansy +Marigold +Lemon Balm +Mustard +Marjoram +Dandelions] +Fruit Tree Antagonists:[ +Grass] + +Garlic Companions:[ +Cucumber +Rose +Tomato +Broccoli +Beets +Peas +Cabbage +Lettuce +Tarragon +Celery +Potato +Fruit Trees] +Garlic Antagonists:[ +Peas +Grape Vine +Beans (all)] + +Grape Vine Companions:[ +Basil +Beans (all) +Peas +Chives +Mustard +Oregano +Peas +Geraniums +Blackberries] +Grape Vine Antagonists:[ +Cabbage +Garlic +Radish] + +Kale Companions:[ +Beets +Celery +Spinach +Marigold +Cabbage +Cauliflower +Nasturtiums +Aromatic Herbs] +Kale Antagonists:[ +Grape Vine +Beans (all) +Strawberry] + +Kohlrabi Companions:[ +Cucumber +Thyme +Sage +Cabbage +Cauliflower +Beets +Onion +Aromatic Herbs] +Kohlrabi Antagonists:[ +Climbing Bean +Pepper +Tomato +Fennel] + +Lettuce Companions:[ +Broccoli +Beans (Bush & Climbing) +Carrot +Beets +Onion +Radish +Kohlrabi +Dill +Cucumber +Strawberry +Thyme +Coriander +Nasturtiums +Parsnips] +Lettuce Antagonists:[ +Cabbage +Parsley +Celery] + +Marjoram Companions:[ +All Plants +Squash +Beans (all) +Eggplant] +Marjoram Antagonists:[ +None] + +Mustard Companions:[ +Mulberry +Grape Vine +Fruit Trees +Beans (all) +Broccoli +Cabbage +Radish +Cauliflower +Brussels Sprouts +Turnip +Alfalfa] +Mustard Antagonists:[ +None] + +Mulberry Companions:[ +Alliums +Marigold +Grass] +Mulberry Antagonists:[ +None] + +Nasturtium Companions:[ +Apple +Beans (all) +Cabbage +Squash +Tomato +Fruit Trees +Broccoli +Brussels Sprouts +Radish +Cucumber +Pumpkin +Potato] +Nasturtium Antagonists:[ +Cauliflower] + +Onion Companions:[ +Carrot +Strawberry +Chamomile +Beets +Cabbage +Cauliflower +Lettuce +Parsnip +Pepper +Cucumber +Dill +Marigold +Tomato +Savory +Broccoli] +Onion Antagonists:[ +Peas +Lentils +Asparagus] + +Oregano Companions:[ +All Plants +Cabbage +Cauliflower +Cucumber] +Oregano Antagonists:[ +None] + +Parsley Companions:[ +Asparagus +Rose +Tomato +Corn +Apple] +Parsley Antagonists:[ +Onion +Garlic +Chive +Shallot +Lettuce +Mint] + +Parsnip Companions:[ +Bush Beans +Pepper +Potato +Radish +Fruit Trees] +Parsnip Antagonists:[ +Carrot +Celery] + +Pea Companions:[ +Corn +Carrot +Eggplant +Turnip +Cauliflower +Garlic +Broccoli +Brussels Sprouts +Mint +Cucumber +Beans (all)] +Pea Antagonists:[ +Chive +Potato +Onion] + +Pepper Companions:[ +Basil +Tomato +Sunflower +Carrot +Eggplant +Onion +Parsley +Okra +Marjoram +Mustard +Geraniums +Petunias] +Pepper Antagonists:[ +Beans (all) +Kale +Apricot +Fennel +Kohlrabi +Brussels Sprouts] + +Pennyroyal top:[ +Pennyroyal Companions +Cabbage +Kale +Cauliflower] +Pennyroyal Antagonists:[ +None] + +Potato Companions:[ +Beans (all) +Horseradish +Thyme +Basil +Cabbage +Corn +Eggplant +Marigold +Peas +Broccoli +Corn +Onion +Garlic +Clover] +Potato Antagonists:[ +Carrot +Pumpkin +Tomato +Cucumber +Sunflower +Squash +Apple +Cherry +Raspberry +Walnut] + +Pumpkin Companions:[ +Corn +Squash +Nasturtium +Beans (all) +Oregano +Radish] +Pumpkin Antagonists:[ +Potato] + +Radish Companions:[ +Chervil +Lettuce +Nasturtium +Squash +Eggplant +Cucumber +Peas +Beans (all) +Melons] +Radish Antagonists:[ +Grape Vine +Brussels Sprout +Turnip] + +Rosemary Companions:[ +Cabbage +Beans (all) +Sage +Carrot +Sage +Broccoli] +Rosemary Antagonists:[ +Tomato] + +Rose Companions:[ +Garlic +Rose +Parsley +Chive +Marigold] +Rose Antagonists:[ +None] + +Rue top:[ +Rue Companions +Fruit Trees +Lavender +Carrot] +Rue Antagonists:[ +Basil +Broccoli +Cabbage] + +Sage Companions:[ +Broccoli +Cauliflower +Carrot +Rosemary +Cabbage +Brussels Sprouts +Tomato +Strawberry +Marjoram +Beans (all)] +Sage Antagonists:[ +Cucumber +Onion +Rue] + +Savory Companions:[ +Beans (all) +Onion +Melon] +Savory Antagonists:[ +None] + +Silverbeet Companions:[ +Beets +Cherry +Lavender] +Silverbeet Antagonists:[ +Basil] + +Soybean Companions:[ +Corn +Sunflower +Asparagus +Potato] +Soybean Antagonists:[ +Beans (all) +Onions +Garlic] + +Spinach Companions:[ +Strawberry +Peas +Beans (all) +Celery +Cauliflower +Eggplant +Peas +Beans +Broccoli] +Spinach Antagonists:[ +None] + +Squash Companions:[ +Borage +Corn +Beans (all) +Okra +Radish +Marigold +Nasturtium +Tansy] +Squash Antagonists:[ +Potato] + +Strawberry Companions:[ +Borage +Spinach +Thyme +Bush Beans +Onion +Lettuce +Sage] +Strawberry Antagonists:[ +Cabbage +Broccoli +Cauliflower +Tomato +Potato +Eggplant +Pepper +Melons +Okra +Mint +Rose] + +Stinging Nettle Companions:[ +Chamomile +Tomato +Marjoram +Mint +Broccoli +Sage] +Stinging Nettle Antagonists:[ +None] + +Sunflower Companions:[ +Pepper +Corn +Soybeans +Cucumber +Tomato +Swan Plant] +Sunflower Antagonists:[ +Climbing Beans +Garlic +Potato] + +Swiss Chard Companions:[ +Bush Beans +Kohlrabi +Onion +Broccoli +Brussels Sprouts +Cabbage +Cauliflower +Radish +Turnip] +Swiss Chard Antagonists:[ +Climbing Beans] + +Tarragon Companions:[ +All Plants +Eggplant +Tomato +Pepper] +Tarragon Antagonists:[ +None] + +Thyme Companions:[ +All Plants +Cabbage +Potato +Brussels Sprout +Eggplant +Strawberry +Tomato] +Thyme Antagonists:[ +None] + +Tomato Companions:[ +Aspargus +Basil +Garlic +Beans (all) +Oregano +Rose +Brocolli +Cabbage +Celery +Pepper +Marigold +Borage +Parsley +Coriander +Chive +Carrot +Eggplant +Sage +Thyme +Mint +Mustard +Rosemary +Stinging Nettle] +Tomato Antagonists:[ +Corn +Dill +Potato +Fennel +Kohlrabi +Walnut] + +Turnip Companions:[ +Broccoli +Peas +Cabbage] +Turnip Antagonists:[ +Potato +Radish +Carrot +Mustard] + +Yarrow Companions:[ +Most Plants (especially aromatic) +Apricot +Chervil +Grape Vine] +Yarrow Antagonists:[ +None] + +Zucchini Companions:[ +Corn +Marjoram +Parsnip] +Zucchini Antagonists:[ +Potato] \ No newline at end of file diff --git a/src/data/compatibility_matrix.json b/src/data/compatibility_matrix.json new file mode 100644 index 0000000000000000000000000000000000000000..1f3eecc5d706a6a0b3ef6318eaf82e9fcb757972 --- /dev/null +++ b/src/data/compatibility_matrix.json @@ -0,0 +1,4762 @@ +{ + "Apricot": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 1, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 1, + "Fruit Trees": 0, + "Garlic": 1, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 1, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 1, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 1, + "Sunflower": 1, + "Tansy": 0, + "Thyme": 0, + "Tomato": -1, + "Yarrow": 1, + "Zucchini": 0 + }, + "Apple": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 1, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 1, + "Fruit Trees": 0, + "Garlic": 1, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": -1, + "Horseradish": 1, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 1, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 1, + "Nasturtiums": 1, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": -1, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 1, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 1, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 1, + "Zucchini": 0 + }, + "Asparagus": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 1, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 1, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 1, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Basil": { + "Apricot": 1, + "Apple": 0, + "Asparagus": 1, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 1, + "Dill": 0, + "Eggplant": 0, + "Fennel": 1, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": -1, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": -1, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Beans": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 1, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": -1, + "Coriander": 0, + "Corn": 1, + "Cucumber": 1, + "Dill": 0, + "Eggplant": 1, + "Fennel": -1, + "Marigold": 1, + "Fruit Trees": 0, + "Garlic": -1, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 1, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": -1, + "Parsley": 1, + "Parsnip": 1, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 1, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 1, + "Roses": 0, + "Rue": 0, + "Sage": 1, + "Savory": 0, + "Shallots": -1, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Broad Beans": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 1, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": -1, + "Coriander": 0, + "Corn": 1, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": -1, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": -1, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 1, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": -1, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 1, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 1, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Bush Beans": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 1, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 1, + "Cherry": 0, + "Chervil": 0, + "Chives": -1, + "Coriander": 0, + "Corn": 1, + "Cucumber": 1, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": -1, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": -1, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 1, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 1, + "Stinging Nettle": 0, + "Sunflower": 1, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Climbing Beans": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": -1, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": -1, + "Coriander": 0, + "Corn": 1, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": -1, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 1, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": -1, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 1, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": -1, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Beets": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 1, + "Climbing Beans": -1, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 1, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 1, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 1, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 1, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 1, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": -1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Borage": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 1, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 1, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 1, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Broccoli": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 1, + "Broad Beans": 1, + "Bush Beans": 1, + "Climbing Beans": 1, + "Beets": 1, + "Borage": 1, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 1, + "Corn": 0, + "Cucumber": 1, + "Dill": 1, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 1, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 1, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 1, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": -1, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": -1, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Brussel Sprouts": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 1, + "Broad Beans": 1, + "Bush Beans": 1, + "Climbing Beans": 1, + "Beets": 1, + "Borage": 1, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 1, + "Corn": 0, + "Cucumber": 1, + "Dill": 1, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 1, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 1, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 1, + "Stinging Nettle": 0, + "Sunflower": 1, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Cabbages": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 1, + "Broad Beans": 1, + "Bush Beans": 1, + "Climbing Beans": 1, + "Beets": 1, + "Borage": 1, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 1, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 1, + "Corn": 0, + "Cucumber": 1, + "Dill": 1, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 1, + "Fruit Trees": 0, + "Garlic": -1, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 1, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 1, + "Marjoram": 1, + "Mints": 1, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 1, + "Onions": 1, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 1, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 1, + "Roses": 0, + "Rue": -1, + "Sage": 1, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": -1, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 1, + "Thyme": 1, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Chamomile": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": -1, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Carrots": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 1, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 1, + "Coriander": 1, + "Corn": 0, + "Cucumber": 1, + "Dill": 1, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 1, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 1, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 1, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 1, + "Parsley": 0, + "Parsnip": -1, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 1, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 1, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Cauliflower": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 1, + "Broad Beans": 1, + "Bush Beans": 1, + "Climbing Beans": 1, + "Beets": 1, + "Borage": 1, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 1, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 1, + "Corn": 0, + "Cucumber": 1, + "Dill": 1, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 1, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 1, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 1, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": -1, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": -1, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Celery": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 1, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 1, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 1, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": -1, + "Peas": 0, + "Pennyroyal": 0, + "Potato": -1, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Cherry": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 1, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 1, + "Fruit Trees": 0, + "Garlic": 1, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": -1, + "Horseradish": 1, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 1, + "Lettuce": 1, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 1, + "Nasturtiums": 1, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": -1, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 1, + "Spinach": 1, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 1, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 1, + "Zucchini": 0 + }, + "Chervil": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 1, + "Corn": 0, + "Cucumber": 0, + "Dill": 1, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 1, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 1, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Chives": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 1, + "Beans": -1, + "Broad Beans": -1, + "Bush Beans": -1, + "Climbing Beans": -1, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 1, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 1, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 1, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 1, + "Parsnip": 1, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 1, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 1, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Coriander": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 1, + "Brussel Sprouts": 1, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 1, + "Cauliflower": 1, + "Celery": 0, + "Cherry": 0, + "Chervil": 1, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": -1, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Corn": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 1, + "Broad Beans": 1, + "Bush Beans": 1, + "Climbing Beans": 1, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 1, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 1, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 1, + "Pumpkin": 1, + "Radish": 1, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 1 + }, + "Cucumber": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 1, + "Beans": 1, + "Broad Beans": 0, + "Bush Beans": 1, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 1, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 1, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 1, + "Cucumber": 0, + "Dill": 1, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 1, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 1, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": -1, + "Pumpkin": 0, + "Radish": 1, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": -1, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 1, + "Tansy": 1, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Dill": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 1, + "Borage": 0, + "Broccoli": 1, + "Brussel Sprouts": 1, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 1, + "Cauliflower": 1, + "Celery": 1, + "Cherry": 0, + "Chervil": 1, + "Chives": 0, + "Coriander": 1, + "Corn": 0, + "Cucumber": 1, + "Dill": 0, + "Eggplant": 0, + "Fennel": 1, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Eggplant": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 1, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 1, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Fennel": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 1, + "Beans": -1, + "Broad Beans": -1, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": -1, + "Corn": 0, + "Cucumber": 0, + "Dill": 1, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": -1, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Marigold": { + "Apricot": 1, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 1, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 1, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 1, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 1, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 1, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 1, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 1, + "Rosemary": 0, + "Roses": 1, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 1, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Fruit Trees": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 1, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 1, + "Fruit Trees": 0, + "Garlic": 1, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": -1, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 1, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 1, + "Nasturtiums": 1, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 1, + "Spinach": 1, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 1, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 1, + "Zucchini": 0 + }, + "Garlic": { + "Apricot": 1, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": -1, + "Broad Beans": -1, + "Bush Beans": -1, + "Climbing Beans": -1, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": -1, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 1, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 1, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 1, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 1, + "Roses": 1, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": -1, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Gooseberry": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Grape Vine": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 1, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 1, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 1, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 1, + "Zucchini": 0 + }, + "Grass": { + "Apricot": -1, + "Apple": -1, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": -1, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": -1, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 1, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": -1, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 1, + "Zucchini": 0 + }, + "Horseradish": { + "Apricot": 1, + "Apple": 1, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 1, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 1, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 1, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 1, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Lavendar": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": -1, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 1, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 1, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 1, + "Spinach": 0, + "Squash": 0, + "Strawberries": 1, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Leeks": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 1, + "Cauliflower": 0, + "Celery": 1, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 1, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Lemon Balm": { + "Apricot": 1, + "Apple": 1, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 1, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 1, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 1, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 1, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Lettuce": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 1, + "Broad Beans": 1, + "Bush Beans": 0, + "Climbing Beans": 1, + "Beets": 1, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 1, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 1, + "Chervil": 1, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 1, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 1, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 1, + "Parsley": -1, + "Parsnip": 1, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 1, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 1, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Marjoram": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 1, + "Basil": 0, + "Beans": 1, + "Broad Beans": 1, + "Bush Beans": 1, + "Climbing Beans": 1, + "Beets": 1, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 1, + "Cauliflower": 0, + "Celery": 1, + "Cherry": 0, + "Chervil": 0, + "Chives": 1, + "Coriander": 0, + "Corn": 1, + "Cucumber": 1, + "Dill": 0, + "Eggplant": 1, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 1, + "Leeks": 1, + "Lemon Balm": 0, + "Lettuce": 1, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 1, + "Parsley": 0, + "Parsnip": 1, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 1, + "Pumpkin": 1, + "Radish": 1, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 1, + "Silverbeet": 1, + "Spinach": 1, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 1 + }, + "Mints": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": -1, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": -1, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Mulberry": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 1, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 1, + "Fruit Trees": 0, + "Garlic": 1, + "Gooseberry": 0, + "Grape Vine": 1, + "Grass": 1, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 1, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 1, + "Nasturtiums": 1, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 1, + "Spinach": 1, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 1, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 1, + "Zucchini": 0 + }, + "Mustard": { + "Apricot": 1, + "Apple": 1, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 1, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 1, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 1, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 1, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Nasturtiums": { + "Apricot": 1, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 1, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 1, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 1, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 1, + "Pumpkin": 0, + "Radish": 1, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 1, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 1 + }, + "Onions": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": -1, + "Broad Beans": -1, + "Bush Beans": -1, + "Climbing Beans": -1, + "Beets": 1, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 1, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 1, + "Lemon Balm": 0, + "Lettuce": 1, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 1, + "Parsnip": 1, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 1, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 1, + "Spinach": 0, + "Squash": 0, + "Strawberries": 1, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Parsley": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 1, + "Basil": 0, + "Beans": 1, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 1, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": -1, + "Marjoram": 0, + "Mints": -1, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 1, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 1, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Parsnip": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 1, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": -1, + "Cauliflower": 0, + "Celery": -1, + "Cherry": 0, + "Chervil": 0, + "Chives": 1, + "Coriander": 1, + "Corn": 1, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 1, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 1, + "Parsley": 0, + "Parsnip": 0, + "Peas": 1, + "Pennyroyal": 0, + "Potato": 1, + "Pumpkin": 0, + "Radish": 1, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 1, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Peas": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 1, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 1, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 1, + "Cauliflower": 0, + "Celery": 1, + "Cherry": 0, + "Chervil": 0, + "Chives": -1, + "Coriander": 0, + "Corn": 1, + "Cucumber": 1, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": -1, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 1, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": -1, + "Parsley": 0, + "Parsnip": 1, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 1, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 1, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 1, + "Savory": 0, + "Shallots": -1, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Pennyroyal": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Potato": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 1, + "Broad Beans": 1, + "Bush Beans": 1, + "Climbing Beans": 0, + "Beets": 1, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": -1, + "Cherry": -1, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 1, + "Cucumber": -1, + "Dill": 0, + "Eggplant": 1, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 1, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 1, + "Onions": 0, + "Parsley": 0, + "Parsnip": 1, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": -1, + "Radish": 0, + "Raspberry": -1, + "Rosemary": -1, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": -1, + "Tansy": 0, + "Thyme": 0, + "Tomato": -1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Pumpkin": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 1, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Radish": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 1, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 1, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 1, + "Chives": 0, + "Coriander": 0, + "Corn": 1, + "Cucumber": 1, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 1, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 1, + "Onions": 0, + "Parsley": 0, + "Parsnip": 1, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 1, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Raspberry": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 1, + "Pennyroyal": 0, + "Potato": -1, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 1, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Rosemary": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 1, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 1, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 1, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 1, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 1, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": -1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Roses": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 1, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 1, + "Fruit Trees": 0, + "Garlic": 1, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 1, + "Lavendar": 1, + "Leeks": 0, + "Lemon Balm": 1, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 1, + "Onions": 1, + "Parsley": 1, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 1, + "Sage": 1, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 1, + "Thyme": 1, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Rue": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": -1, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": -1, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 1, + "Rosemary": 0, + "Roses": 1, + "Rue": 0, + "Sage": -1, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Sage": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 1, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 1, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": -1, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": -1, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 1, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 1, + "Roses": 1, + "Rue": -1, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 1, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Savory": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 1, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 1, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Shallots": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": -1, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": -1, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Silverbeet": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": -1, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 1, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 1, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 1, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 1, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 1, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Spinach": { + "Apricot": 1, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 1, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 1, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 1, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 1, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Squash": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 1, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 1, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 1, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 1, + "Tansy": 1, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Strawberries": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 1, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 1, + "Broccoli": -1, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 1, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 1, + "Fruit Trees": 0, + "Garlic": -1, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 1, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 1, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 1, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 1, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 1, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Stinging Nettle": { + "Apricot": 1, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 1, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 1, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 1, + "Yarrow": 0, + "Zucchini": 0 + }, + "Sunflower": { + "Apricot": 1, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 1, + "Climbing Beans": -1, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 1, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Tansy": { + "Apricot": 1, + "Apple": 1, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 1, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 1, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 1, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 1, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 1, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 1, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 1, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 1, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 1, + "Zucchini": 0 + }, + "Thyme": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 1, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 1, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Tomato": { + "Apricot": -1, + "Apple": 0, + "Asparagus": 1, + "Basil": 1, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": -1, + "Borage": 1, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": -1, + "Chamomile": 0, + "Carrots": 1, + "Cauliflower": 0, + "Celery": 1, + "Cherry": 0, + "Chervil": 0, + "Chives": 1, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 1, + "Eggplant": 0, + "Fennel": -1, + "Marigold": 1, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 1, + "Grape Vine": 1, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 1, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 1, + "Onions": 1, + "Parsley": 1, + "Parsnip": 1, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": -1, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Yarrow": { + "Apricot": 1, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 1, + "Chives": 0, + "Coriander": 0, + "Corn": 0, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 1, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 1, + "Grass": 1, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 0, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 0, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 1, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + }, + "Zucchini": { + "Apricot": 0, + "Apple": 0, + "Asparagus": 0, + "Basil": 0, + "Beans": 0, + "Broad Beans": 0, + "Bush Beans": 0, + "Climbing Beans": 0, + "Beets": 0, + "Borage": 0, + "Broccoli": 0, + "Brussel Sprouts": 0, + "Cabbages": 0, + "Chamomile": 0, + "Carrots": 0, + "Cauliflower": 0, + "Celery": 0, + "Cherry": 0, + "Chervil": 0, + "Chives": 0, + "Coriander": 0, + "Corn": 1, + "Cucumber": 0, + "Dill": 0, + "Eggplant": 0, + "Fennel": 0, + "Marigold": 0, + "Fruit Trees": 0, + "Garlic": 0, + "Gooseberry": 0, + "Grape Vine": 0, + "Grass": 0, + "Horseradish": 0, + "Lavendar": 0, + "Leeks": 0, + "Lemon Balm": 0, + "Lettuce": 0, + "Marjoram": 1, + "Mints": 0, + "Mulberry": 0, + "Mustard": 0, + "Nasturtiums": 1, + "Onions": 0, + "Parsley": 0, + "Parsnip": 0, + "Peas": 0, + "Pennyroyal": 0, + "Potato": 0, + "Pumpkin": 0, + "Radish": 0, + "Raspberry": 0, + "Rosemary": 0, + "Roses": 0, + "Rue": 0, + "Sage": 0, + "Savory": 0, + "Shallots": 0, + "Silverbeet": 0, + "Spinach": 0, + "Squash": 0, + "Strawberries": 0, + "Stinging Nettle": 0, + "Sunflower": 0, + "Tansy": 0, + "Thyme": 0, + "Tomato": 0, + "Yarrow": 0, + "Zucchini": 0 + } +} \ No newline at end of file diff --git a/src/data/plant_compatibility.csv b/src/data/plant_compatibility.csv new file mode 100644 index 0000000000000000000000000000000000000000..7618f78b431e8c9256d28cadfa2feefc1c5ec7a8 --- /dev/null +++ b/src/data/plant_compatibility.csv @@ -0,0 +1,69 @@ +,Apricot,Apple,Asparagus,Basil,Beans,Broad Beans,Bush Beans,Climbing Beans,Beets,Borage,Broccoli,Brussel Sprouts,Cabbages,Chamomile,Carrots,Cauliflower,Celery,Cherry,Chervil,Chives,Coriander,Corn,Cucumber,Dill,Eggplant,Fennel,Marigold,Fruit Trees,Garlic,Gooseberry,Grape Vine,Grass,Horseradish,Lavendar,Leeks,Lemon Balm,Lettuce,Marjoram,Mints,Mulberry,Mustard,Nasturtiums,Onions,Parsley,Parsnip,Peas,Pennyroyal,Potato,Pumpkin,Radish,Raspberry,Rosemary,Roses,Rue,Sage,Savory,Shallots,Silverbeet,Spinach,Squash,Strawberries,Stinging Nettle,Sunflower,Tansy,Thyme,Tomato,Yarrow,Zucchini +Apricot,,,,1,,,,,,,,,,,,,,,,,,,,,,,1,,1,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,1,,,1,1,,,-1,1, +Apple,,,,,,,,,,,,,,,,,,,,1,,,,,,,1,,1,,,-1,1,,,1,,,,,1,1,,,,,,-1,,,,,,,,,,,1,,,,,1,,,1, +Asparagus,,,,1,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,1,,,,,,1,,,,,,,,,,,,,,,,,,,,,,1,, +Basil,1,,1,,,,,,,,,,,,,,,,,,,,1,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,-1,,,,-1,,,,,,,,1,, +Beans,,,,,,,,,,,,,1,,1,,,,,-1,,1,1,,1,-1,1,,-1,,,,,,,,1,1,,,,,-1,1,1,,,1,,,,1,,,1,,-1,,,,,,,,,,, +Broad Beans,,,,,,,,,,,,,1,,1,,,,,-1,,1,,,,-1,,,-1,,,,,,,,1,1,,,,,-1,,,,,1,,,,,,,,,,,1,,,,,,,,, +Bush Beans,,,,,,,,,1,,,,1,,,,1,,,-1,,1,1,,,,,,-1,,,,,,,,,1,,,,,-1,,,,,1,,,,,,,,,,,,,1,,1,,,,, +Climbing Beans,,,,,,,,,-1,,,,1,,,,,,,-1,,1,,,,,,,-1,,,,,,,,1,1,,,,,-1,,,,,,,1,,,,,,,,,,,,,-1,,,,, +Beets,,,,,,,1,-1,,,,,1,,,,,,,,,,,1,,,,,,,,,,,,,1,1,,,,,1,,,,,1,,,,,,,,,,1,,,,,,,,-1,, +Borage,,,,,,,,,,,,,1,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,1,,1,, +Broccoli,,,,,1,1,1,1,1,1,,,,,,,,,,,1,,1,1,,,1,,,,,,,,,,,1,,,,1,,,,,,1,,,,,,-1,,,,,,,-1,,,,,1,, +Brussel Sprouts,,,,,1,1,1,1,1,1,,,,,,,,,,,1,,1,1,,,1,,,,,,,,,,,1,,,,,,,,,,1,,,,,,,,,,,,,1,,1,,,,, +Cabbages,,,,,1,1,1,1,1,1,,,,,,,1,,,,1,,1,1,,,1,,-1,,,,,1,,,1,1,1,,,1,1,,,,,1,,,,1,,-1,1,,,,,,-1,,,1,1,,, +Chamomile,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Carrots,,,,,1,,,,,,,,,,,,,,,1,1,,1,1,,,,1,,,,,,1,,,1,1,,,,,1,,-1,,,,,1,,,,1,,,,,,,,,,,,1,, +Cauliflower,,,,,1,1,1,1,1,1,,,,,,,1,,,,1,,1,1,,,1,,,,,,,,,,1,,,,,,,,,,,1,,,,,,-1,,,,,-1,,,,,,,1,, +Celery,,,,,,,1,,,,,,1,,,,,,,,,,,1,,,,,,,,,,,1,,,1,,,,,,,-1,,,-1,,,,,,,,,,,,,,,,,,1,, +Cherry,,,,,,,,,,,,,,,,,,,,1,,,,,,,1,,1,,,-1,1,,,1,1,,,,1,1,,,,,,-1,,,,,,,,,,1,1,,,,,1,,,1, +Chervil,,,,,,,,,,,,,,,,,,,,,1,,,1,,,,,,,,,,,,,1,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,, +Chives,,,,1,-1,-1,-1,-1,,,,,,,1,,,1,,,,,,,,,,1,,,,,,,,,,1,,,,,,1,1,,,,,,,,1,,,,,,1,,,,,,,1,, +Coriander,,,,,,,,,,,1,1,1,,1,1,,,1,,,,,,,-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Corn,,,,,1,1,1,1,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,1,,,,,,,1,,,1,1,1,,,,,,,,,,,,,,,,,,1 +Cucumber,,,,1,1,,1,,,1,,,1,,1,,,,,,,1,,1,,,,,,,,,,,,,1,1,,,,1,,,,,,-1,,1,,,,,-1,,,,,,,,1,1,,,, +Dill,,,,,,,,,1,,1,1,1,,1,1,1,,1,,1,,1,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,, +Eggplant,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,, +Fennel,,,,1,-1,-1,,,,,,,,,,,,,,,-1,,,1,,,,,,,,,,-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,, +Marigold,1,,,,1,,,,,,,,1,,1,,,1,,,,,,,,,,1,,,,,,,,,1,,,,,,,,,,,1,,,1,,1,,,,,,,,1,,,,,1,, +Fruit Trees,,,,,,,,,,,,,,,,,,,,1,,,,,,,1,,1,,,-1,,,,1,,,,,1,1,,,,,,,,,,,,,,,,1,1,,,,,1,,,1, +Garlic,1,,,,-1,-1,-1,-1,,,,,-1,,,,,,1,,,,,,,,,1,,,,,,1,,,,,,,,,,,,,,,,,,1,1,,,,,,,,,,-1,,,,, +Gooseberry,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,, +Grape Vine,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,1,,1,1, +Grass,-1,-1,,,,,,,,,,,,,,,,-1,,,,,,,,,,-1,,,,,,,,,,,,1,,,,,,,,,,,,,,,-1,,,,,,,,,,,,1, +Horseradish,1,1,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,,,1,,,,,,,,,1,,,,,, +Lavendar,,,,,,,,,,,,,1,,,,,,,,,,,,,-1,,,1,,,,,,,,,1,,,,,,,,,,,,,,,1,,,,,1,,,1,,,,,,, +Leeks,,,,,,,,,,,,,,,1,,1,,,,,,,,,,,,,,,,,,,,,1,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,, +Lemon Balm,1,1,,,,,,,,,,,,,,,,1,,,,,,,,,,1,,,,,,,,,,,,1,,,,,,,,,,,,,1,,,,,,,,,,,,,,, +Lettuce,,,,,1,1,,1,1,,,,1,,1,,,1,1,,,,1,,,,1,,,,,,,,,,,1,,,,,1,-1,1,,,,,1,,,,,,,,,,,1,,,,,,, +Marjoram,,,1,,1,1,1,1,1,,,,1,,1,,1,,,1,,1,1,,1,,,,,,,,,1,1,,1,,,,,,1,,1,,,1,1,1,,,,,,,1,1,1,,,,,,,1,,1 +Mints,,,,,,,,,,,,,1,-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-1,,,,,,,,,,,,,,,,,,,,,,1,, +Mulberry,,,,,,,,,,,,,,,,,,,,1,,,,,,,1,,1,,1,1,,,,1,,,,,1,1,,,,,,,,,,,,,,,,1,1,,,,,1,,,1, +Mustard,1,1,,,,,,,,,,,,,,,,1,,,,,,,,,,1,,,1,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Nasturtiums,1,,,,,,,,,,,,1,,,,,1,,,,,1,,,,,1,,,,,,,,,,,,,,,,,,,,1,,1,,,1,,,,,,,,,,,,,1,,1 +Onions,,,,,-1,-1,-1,-1,1,,,,1,,1,,,,,,,,,,,,,,,,,,,,1,,1,1,,,,,,1,1,,,,,,,,1,,,,,1,,,1,,,,,1,, +Parsley,,,1,,1,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,-1,,-1,,,,1,,,,,,,,,,1,,,,,,,,,,,,,1,, +Parsnip,,,,,1,,,,,,,,,,-1,,-1,,,1,1,1,,,,,,,,,,,,,,,1,1,,,,,1,,,1,,1,,1,,,,,1,,,,,,,,,,,1,, +Peas,,,,,1,,,,,1,,,1,,1,,1,,,-1,,1,1,,,,,,-1,,,,,,,,1,1,,,,,-1,,1,,,1,,,1,,,,1,,-1,,,,,,,,,,, +Pennyroyal,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Potato,,,,,1,1,1,,1,,,,1,,,,-1,-1,,,,1,-1,,1,,,,,,,,1,,,,,1,,,,1,,,1,,,,-1,,-1,-1,,,,,,,,,,,-1,,,-1,, +Pumpkin,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Radish,,,,,,,,1,,,,,,,1,,,,1,,,1,1,,,,,,,,,,,,,,1,1,,,,1,,,1,,,,,,,,,,,,,,,,,1,,,,,, +Raspberry,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,1,,-1,,,,,,1,,,,,,,,,,,,,, +Rosemary,,,,,1,,,,,,,,1,,1,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,1,,,,,,,,,,,1,,,,,,,,,,,-1,, +Roses,,,,,,,,,,,,,,,,,,,,1,,,,,,,1,,1,,,,1,1,,1,,,,,,1,1,1,,,,,,,,,,1,1,,,,,,,,,1,1,,, +Rue,,,,-1,,,,,,,,,-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,1,,-1,,,,,,,,,,,,, +Sage,,,,,1,,,,,,,,1,,1,,,,,,,,-1,,,,,,,,,-1,,,,,,,,,,,,1,,,,,,,,1,1,-1,,,,,,,1,,,,,,, +Savory,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,, +Shallots,,,,,-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,-1,,,,,,,,,,,,,,,,,,,,,, +Silverbeet,,,,-1,,,,,1,,,,,,,,,1,,,,,,,,,,1,,,,,,1,,,,1,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,, +Spinach,1,,,,,1,,,,,,,,,,,,1,,,,,,,,,,1,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,1,,,,,,, +Squash,,,,,,,,,,1,,,,,,,,,,,,1,,,,,,,,,,,,,,,,1,,,,1,,,,,,,,,,,,,,,,,,,,,1,1,,,, +Strawberries,,,,,,,1,,,1,-1,,,,,,,,,1,,,,,,,1,,-1,,,,,1,,,1,,,,,,1,,,,,,,,,,,,1,,,1,0,,,,,,,,, +Stinging Nettle,1,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,1,, +Sunflower,1,,,,,,1,-1,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +Tansy,1,1,,,,,,,,1,,,1,,,,,1,,,,,1,,,,,1,,,1,,,,,,,,,1,,,,,,,,,,,,,1,,,,,,,1,,,,,,,1, +Thyme,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,, +Tomato,-1,,1,1,,,,,-1,1,,,-1,,1,,1,,,1,,,,1,,-1,1,,,1,1,,,,,,,1,1,,,1,1,1,1,,,,,,,-1,,,,,,,,,,,,,,,, +Yarrow,1,,,,,,,,,,,,,,,,,,1,,,,,,,,,1,,,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,, +Zucchini,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,1,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,, diff --git a/src/frontend/__pycache__/visualizations.cpython-310.pyc b/src/frontend/__pycache__/visualizations.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ed186c7c85ec15bf0659b83f8bb4645530628d90 Binary files /dev/null and b/src/frontend/__pycache__/visualizations.cpython-310.pyc differ diff --git a/src/frontend/__pycache__/visualizations.cpython-311.pyc b/src/frontend/__pycache__/visualizations.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cdc08045a7773769b62895c9c9fee928edd7c699 Binary files /dev/null and b/src/frontend/__pycache__/visualizations.cpython-311.pyc differ diff --git a/src/frontend/visualizations.py b/src/frontend/visualizations.py new file mode 100644 index 0000000000000000000000000000000000000000..7722db3f5aff41a3b9e393f7cd2c92eaaa813eb1 --- /dev/null +++ b/src/frontend/visualizations.py @@ -0,0 +1,354 @@ +import streamlit as st +import networkx as nx +import plotly.graph_objects as go +import matplotlib.pyplot as plt +import numpy as np +from streamlit_agraph import agraph, Node, Edge, Config + +def plot_compatibility(plants, compatibility_matrix, is_mini=False): + + # Create the graph + G = nx.Graph() + G.add_nodes_from(plants) + for i in range(len(plants)): + for j in range(i + 1, len(plants)): + if compatibility_matrix[i][j] == 0: + G.add_edge(plants[i], plants[j], color='dimgrey') + else: + G.add_edge(plants[i], plants[j], color='green' if compatibility_matrix[i][j] == 1 else 'mediumvioletred') + + # Generate positions for the nodes + pos = nx.spring_layout(G) + + # Create node trace + node_trace = go.Scatter( + x=[pos[node][0] for node in G.nodes()], + y=[pos[node][1] for node in G.nodes()], + text=list(G.nodes()), + mode='markers+text', + textposition='top center', + hoverinfo='text', + marker=dict( + size=40, + color='lightblue', + line_width=2, + ) + ) + + # Create edge trace + edge_trace = go.Scatter( + x=[], + y=[], + line=dict(width=1, color='dimgrey'), + hoverinfo='none', + mode='lines' + ) + + # Add coordinates to edge trace + for edge in G.edges(): + x0, y0 = pos[edge[0]] + x1, y1 = pos[edge[1]] + edge_trace['x'] += tuple([x0, x1, None]) + edge_trace['y'] += tuple([y0, y1, None]) + + # Create edge traces for colored edges + edge_traces = [] + edge_legend = set() # Set to store unique edge colors + for edge in G.edges(data=True): + x0, y0 = pos[edge[0]] + x1, y1 = pos[edge[1]] + color = edge[2]['color'] + trace = go.Scatter( + x=[x0, x1], + y=[y0, y1], + mode='lines', + line=dict(width=2, color=color), + hoverinfo='none' + ) + edge_traces.append(trace) + edge_legend.add(color) # Add edge color to the set + + # Create layout + layout = go.Layout( + showlegend=False, + hovermode='closest', + margin=dict(b=20, l=5, r=5, t=40), + xaxis=dict(showgrid=False, zeroline=False, showticklabels=False), + yaxis=dict(showgrid=False, zeroline=False, showticklabels=False) + ) + + # Create figure + fig = go.Figure(data=[edge_trace, *edge_traces, node_trace], layout=layout) + + + # Create custom legend for edge colors + custom_legend = [] + legend_names = ['Neutral', 'Negative', 'Positive'] + legend_colors = ['dimgrey', 'mediumvioletred', 'green'] + + for name, color in zip(legend_names, legend_colors): + custom_legend.append( + go.Scatter( + x=[None], + y=[None], + mode='markers', + marker=dict(color=color), + name=f'{name}', + showlegend=True, + hoverinfo='none' + ) + ) + if is_mini == False: + # Create layout for custom legend figure + legend_layout = go.Layout( + title='Plant Compatibility Network Graph', + showlegend=True, + margin=dict(b=1, t=100), + xaxis=dict(showgrid=False, zeroline=False, showticklabels=False), + yaxis=dict(showgrid=False, zeroline=False, showticklabels=False), + height=120, + legend=dict( + title='Edge Colors', + orientation='h', + x=-1, + y=1.1, + bgcolor='rgba(0,0,0,0)' + ) + ) + else: + fig.update_layout( + autosize=False, + width=300, + height=300,) + + + + if is_mini == False: + # Create figure for custom legend + legend_fig = go.Figure(data=custom_legend, layout=legend_layout) + # Render the custom legend using Plotly in Streamlit + st.plotly_chart(legend_fig, use_container_width=True) + + + # Render the graph using Plotly in Streamlit + st.plotly_chart(fig) + + + +# this is not used as it needs to be refactored and is not working as intended +def show_plant_tips(): + tips_string = st.session_state.plant_care_tips + + tips_list = tips_string.split("\n") + num_tips = len(tips_list) + st.markdown("## Plant Care Tips for your plants: " + str(st.session_state.input_plants_raw) + "\n\n" + st.session_state.plant_care_tips) + + + + +def visualize_groupings_sankey(): + groupings = st.session_state.grouping + compatibility_matrix = st.session_state.extracted_mat + plant_list = st.session_state.input_plants_raw + + for i, bed_species in enumerate(groupings): + st.subheader(f"Plant Bed {i + 1}") + + # Create the nodes + nodes = [] + for species in bed_species: + nodes.append(species) + + # Create the links + links = [] + for j, species1 in enumerate(bed_species): + for k, species2 in enumerate(bed_species): + if j < k: + species1_index = plant_list.index(species1) + species2_index = plant_list.index(species2) + compatibility = compatibility_matrix[species1_index][species2_index] + + if compatibility == 1: + color = 'green' + elif compatibility == -1: + color = 'pink' + else: + color = 'grey' + + links.append(dict(source=j, target=k, value=compatibility, color=color)) + + # Create the Sankey diagram + fig = go.Figure(data=[go.Sankey( + node=dict( + label=nodes, + color="lightblue" + ), + link=dict( + source=[link['source'] for link in links], + target=[link['target'] for link in links], + value=[link['value'] for link in links], + color=[link['color'] for link in links] + ) + )]) + + # Set the layout properties + layout = go.Layout( + plot_bgcolor='black', + paper_bgcolor='black', + title_font=dict(color='white') + ) + + # Set the figure layout + fig.update_layout(layout) + + # Render the Sankey diagram in Streamlit + st.plotly_chart(fig) + + +def visualize_groupings(): + groupings = st.session_state.grouping + compatibility_matrix = st.session_state.extracted_mat + plant_list = st.session_state.input_plants_raw + + def generate_grouping_matrices(groupings, compatibility_matrix, plant_list): + grouping_matrices = [] + for grouping in groupings: + indices = [plant_list.index(plant) for plant in grouping] + submatrix = [[compatibility_matrix[i][j] for j in indices] for i in indices] + grouping_matrices.append(submatrix) + return grouping_matrices + + grouping_matrices = generate_grouping_matrices(groupings, compatibility_matrix, plant_list) + for i, submatrix in enumerate(grouping_matrices): + col1, col2= st.columns([1,3]) + with col1: + st.write(f"Plant Bed {i + 1}") + st.write("Plant List") + st.write(groupings[i]) + with col2: + plot_compatibility_with_agraph(groupings[i], st.session_state.full_mat, is_mini=True) + + + +def plot_compatibility_with_agraph(plants, compatibility_matrix, is_mini=False): + # Create nodes and edges for the graph + nodes = [] + edges = [] + + # Function to get the image URL for a plant + def get_image_url(plant_name): + index = st.session_state.plant_list.index(plant_name) + image_path = f"https://github.com/4dh/GRDN/blob/dev/src/assets/plant_images/plant_{index}.png?raw=true" + print(image_path) + return image_path + + size_n = 32 if not is_mini else 24 + # Create nodes with images + for plant in plants: + nodes.append(Node(id=plant, + label=plant, + # make text bigger + font={'size': 20}, + # spread nodes out + scaling={'label': {'enabled': True}}, + size=size_n, + shape="circularImage", + image=get_image_url(plant))) + + # Create edges based on compatibility + #for i in range(len(st.session_state.plant_list)): + # loop through all plants in raw long list and find the index of the plant in the plant list to get relevant metadata. skip if we are looking at the same plant + for i, i_p in enumerate(st.session_state.plant_list): + for j, j_p in enumerate(st.session_state.plant_list): + if i != j: + # check if plants[i] and plants[j] are in input_plants_raw + # print(st.session_state.input_plants_raw) + if is_mini == False: + length_e = 300 + else: + length_e = 150 + + if i_p in st.session_state.input_plants_raw and j_p in st.session_state.input_plants_raw: + # use the compatibility matrix and the plant to index mapping to determine the color of the edge + if compatibility_matrix[i][j] == 1: + color = 'green' + edges.append(Edge(source=i_p, target=j_p,width = 3.5, type="CURVE_SMOOTH", color=color, length=length_e)) + print(i,j,i_p,j_p,color) + elif compatibility_matrix[i][j] == -1: + color = 'mediumvioletred' + edges.append(Edge(source=i_p, target=j_p,width = 3.5, type="CURVE_SMOOTH", color=color, length=length_e)) + print(i,j,i_p,j_p,color) + + else: + color = 'dimgrey' + edges.append(Edge(source=i_p, target=j_p,width = .2, type="CURVE_SMOOTH", color=color, length=length_e)) + print(i,j,i_p,j_p,color) + + + + # Configuration for the graph + config = Config(width=650 if not is_mini else 400, + height=400 if not is_mini else 400, + directed=False, + physics=True, + hierarchical=False, + nodeHighlightBehavior=True, + highlightColor="#F7A7A6", + collapsible=True, + maxZoom=5, + minZoom=0.2, + initialZoom=4, + ) + + + # Handling for non-mini version + if not is_mini: + # Create custom legend for edge colors at the top of the page + custom_legend = [] + legend_names = ['Neutral', 'Negative', 'Positive'] + legend_colors = ['dimgrey', 'mediumvioletred', 'green'] + + for name, color in zip(legend_names, legend_colors): + custom_legend.append( + go.Scatter( + x=[None], + y=[None], + mode='markers', + marker=dict(color=color), + name=name, + showlegend=True, + hoverinfo='none' + ) + ) + + # Create layout for custom legend figure + legend_layout = go.Layout( + title='Plant Compatibility Network Graph', + showlegend=True, + margin=dict(b=1, t=100), + xaxis=dict(showgrid=False, zeroline=False, showticklabels=False), + yaxis=dict(showgrid=False, zeroline=False, showticklabels=False), + height=120, + legend=dict( + title='Edge Colors', + orientation='h', + # make it appear above the graph + x=-1, + y=1.1, + bgcolor='rgba(0,0,0,0)' + ) + ) + + # Create figure for custom legend + legend_fig = go.Figure(data=custom_legend, layout=legend_layout) + + # Render the custom legend using Plotly in Streamlit + st.plotly_chart(legend_fig, use_container_width=True) + + + # Render the graph using streamlit-agraph + return_value = agraph(nodes=nodes, + edges=edges, + config=config) + + \ No newline at end of file diff --git a/src/requirements.txt b/src/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..52f24b02886fdd527b59c0da0fe19252a8cd2030 --- /dev/null +++ b/src/requirements.txt @@ -0,0 +1,95 @@ +aiohttp==3.8.4 +aiosignal==1.3.1 +altair==5.0.1 +async-timeout==4.0.2 +attrs==23.1.0 +beautifulsoup4==4.12.2 +blinker==1.6.2 +cachetools==5.3.1 +certifi==2023.5.7 +charset-normalizer==3.1.0 +click==8.1.3 +contourpy==1.1.0 +cycler==0.11.0 +dataclasses-json==0.5.8 +decorator==5.1.1 +Faker==18.11.1 +favicon==0.7.0 +fonttools==4.40.0 +frozenlist==1.3.3 +gitdb==4.0.10 +GitPython==3.1.31 +htbuilder==0.6.1 +idna==3.4 +importlib-metadata==6.7.0 +Jinja2==3.1.2 +jsonschema==4.17.3 +kiwisolver==1.4.4 +langchain==0.0.215 +langchainplus-sdk==0.0.17 +lxml==4.9.2 +Markdown==3.4.3 +markdown-it-py==3.0.0 +markdownlit==0.0.7 +MarkupSafe==2.1.3 +marshmallow==3.19.0 +marshmallow-enum==1.5.1 +matplotlib==3.7.1 +mdurl==0.1.2 +more-itertools==9.1.0 +multidict==6.0.4 +mypy-extensions==1.0.0 +networkx==3.1 +numexpr==2.8.4 +numpy==1.25.0 +openai==0.27.8 +openapi-schema-pydantic==1.2.4 +packaging==23.1 +pandas==2.0.2 +Pillow==9.5.0 +plotly==5.15.0 +protobuf==4.23.3 +pyarrow==12.0.1 +pydantic==1.10.9 +pydeck==0.8.1b0 +Pygments==2.15.1 +pymdown-extensions==10.0.1 +Pympler==1.0.1 +pyparsing==3.1.0 +pyrsistent==0.19.3 +python-dateutil==2.8.2 +pytz==2023.3 +pytz-deprecation-shim==0.1.0.post0 +PyYAML==6.0 +requests==2.31.0 +rich==13.4.2 +six==1.16.0 +smmap==5.0.0 +soupsieve==2.4.1 +SQLAlchemy==2.0.17 +st-annotated-text==4.0.0 +streamlit==1.23.1 +streamlit-agraph==0.0.45 +streamlit-camera-input-live==0.2.0 +streamlit-card==0.0.5 +streamlit-chat==0.1.1 +streamlit-embedcode==0.1.2 +streamlit-extras==0.2.7 +streamlit-faker==0.0.2 +streamlit-image-coordinates==0.1.5 +streamlit-keyup==0.2.0 +streamlit-toggle-switch==1.0.2 +streamlit-vertical-slider==1.0.2 +tenacity==8.2.2 +toml==0.10.2 +toolz==0.12.0 +tornado==6.3.2 +tqdm==4.65.0 +typing-inspect==0.9.0 +typing_extensions==4.6.3 +tzdata==2023.3 +tzlocal==4.3.1 +urllib3==2.0.3 +validators==0.20.0 +yarl==1.9.2 +zipp==3.15.0