CesarLeblanc commited on
Commit
721eaca
1 Parent(s): 15ecc3d
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -76,7 +76,7 @@ def classification(text, k):
76
  text = f"This vegetation plot belongs to the habitats {', '.join(habitat_labels[:-1])} and {habitat_labels[-1]}."
77
  habitat_name = eunis_habitats[eunis_habitats['EUNIS 2020 code'] == habitat_labels[0]]['EUNIS-2021 habitat name'].values[0]
78
  text += f"\nThe most likely habitat is '{habitat_name}'."
79
- text += f"\nSee an image of this habitat ({habitat_labels[0]}) below."
80
  image_output = return_habitat_image(habitat_labels[0])
81
  return text, image_output
82
 
@@ -122,7 +122,7 @@ def masking(text, k):
122
  else:
123
  text = f"The most likely missing species are {', '.join(best_predictions[:-1])} and {best_predictions[-1]} (positions {', '.join(map(str, best_positions[:-1]))} and {best_positions[-1]})."
124
  text += f"\nThe new vegetation plot is {best_sentence}."
125
- text += f"\nSee an image of the most likely species ({best_predictions[0]}) below."
126
  image = return_species_image(best_prediction[0])
127
  return text, image
128
 
@@ -137,8 +137,8 @@ with gr.Blocks() as demo:
137
  species_classification = gr.Textbox(lines=2, label="Species", placeholder="Enter a list of comma-separated binomial names here.")
138
  k_classification = gr.Slider(1, 5, value=1, step=1, label="Top-k", info="Choose the number of top habitats to display.")
139
  with gr.Column():
140
- text_classification = gr.Textbox()
141
- image_classification = gr.Image()
142
  button_classification = gr.Button("Classify")
143
  gr.Markdown("""<h5 style="text-align: center;">An example of input</h5>""")
144
  gr.Examples([["sparganium erectum, calystegia sepium, persicaria amphibia", 1]], [species_classification, k_classification], [text_classification, image_classification], classification, True)
@@ -150,8 +150,8 @@ with gr.Blocks() as demo:
150
  species_masking = gr.Textbox(lines=2, label="Species", placeholder="Enter a list of comma-separated binomial names here.")
151
  k_masking = gr.Slider(1, 5, value=1, step=1, label="Top-k", info="Choose the number of top missing species to find.")
152
  with gr.Column():
153
- text_masking = gr.Textbox()
154
- image_masking = gr.Image()
155
  button_masking = gr.Button("Find")
156
  gr.Markdown("""<h5 style="text-align: center;">An example of input</h5>""")
157
  gr.Examples([["vaccinium myrtillus, dryopteris dilatata, molinia caerulea", 1]], [species_masking, k_masking], [text_masking, image_masking], masking, True)
 
76
  text = f"This vegetation plot belongs to the habitats {', '.join(habitat_labels[:-1])} and {habitat_labels[-1]}."
77
  habitat_name = eunis_habitats[eunis_habitats['EUNIS 2020 code'] == habitat_labels[0]]['EUNIS-2021 habitat name'].values[0]
78
  text += f"\nThe most likely habitat is '{habitat_name}'."
79
+ text += f"\nSee an image of this habitat (i.e., {habitat_labels[0]}) below."
80
  image_output = return_habitat_image(habitat_labels[0])
81
  return text, image_output
82
 
 
122
  else:
123
  text = f"The most likely missing species are {', '.join(best_predictions[:-1])} and {best_predictions[-1]} (positions {', '.join(map(str, best_positions[:-1]))} and {best_positions[-1]})."
124
  text += f"\nThe new vegetation plot is {best_sentence}."
125
+ text += f"\nSee an image of the most likely species (i.e., {best_predictions[0]}) below."
126
  image = return_species_image(best_prediction[0])
127
  return text, image
128
 
 
137
  species_classification = gr.Textbox(lines=2, label="Species", placeholder="Enter a list of comma-separated binomial names here.")
138
  k_classification = gr.Slider(1, 5, value=1, step=1, label="Top-k", info="Choose the number of top habitats to display.")
139
  with gr.Column():
140
+ text_classification = gr.Textbox(value="Prediction")
141
+ image_classification = gr.Image(value="https://www.commissionoceanindien.org/wp-content/uploads/2018/07/plantnet.jpg")
142
  button_classification = gr.Button("Classify")
143
  gr.Markdown("""<h5 style="text-align: center;">An example of input</h5>""")
144
  gr.Examples([["sparganium erectum, calystegia sepium, persicaria amphibia", 1]], [species_classification, k_classification], [text_classification, image_classification], classification, True)
 
150
  species_masking = gr.Textbox(lines=2, label="Species", placeholder="Enter a list of comma-separated binomial names here.")
151
  k_masking = gr.Slider(1, 5, value=1, step=1, label="Top-k", info="Choose the number of top missing species to find.")
152
  with gr.Column():
153
+ text_masking = gr.Textbox(value="Prediction")
154
+ image_masking = gr.Image(value="https://www.commissionoceanindien.org/wp-content/uploads/2018/07/plantnet.jpg")
155
  button_masking = gr.Button("Find")
156
  gr.Markdown("""<h5 style="text-align: center;">An example of input</h5>""")
157
  gr.Examples([["vaccinium myrtillus, dryopteris dilatata, molinia caerulea", 1]], [species_masking, k_masking], [text_masking, image_masking], masking, True)