Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Commit 
							
							·
						
						3d01956
	
1
								Parent(s):
							
							27a280b
								
Added example table test
Browse files
    	
        app.py
    CHANGED
    
    | @@ -11,7 +11,27 @@ def predict(image_np, description=None): | |
| 11 | 
             
              confidences = {classes[idx]: f'{prob:.04f}' for idx, prob in enumerate(probs)}
         | 
| 12 | 
             
              return confidences
         | 
| 13 |  | 
| 14 | 
            -
             | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 15 |  | 
| 16 | 
             
            example_list = ["examples/myrtifolia_1c086296-6d1f-4218-a18a-ca2f86c295d0.jpg",
         | 
| 17 | 
             
                            "examples/oleifolia_104f44c9-63f1-4579-93c2-54c6ddeddeda.jpg",
         | 
| @@ -28,6 +48,6 @@ demo = gr.Interface(predict, | |
| 28 | 
             
                                examples=example_list,
         | 
| 29 | 
             
                                description="This model can place herbarium sheet images from the genus Prunus into one of four categories that represent key clades within the genus: Solitary/Corymbose, Temperate Racemose, Neotropical Racemose, Paleotropical Racemose.",
         | 
| 30 | 
             
                                title="Image classification of four major lineages in the plum genus",
         | 
| 31 | 
            -
                                article= | 
| 32 |  | 
| 33 | 
             
            demo.launch()
         | 
|  | |
| 11 | 
             
              confidences = {classes[idx]: f'{prob:.04f}' for idx, prob in enumerate(probs)}
         | 
| 12 | 
             
              return confidences
         | 
| 13 |  | 
| 14 | 
            +
            example_metadata = [{'idigbio_specimen': 'e025ff74-333b-461f-a86e-63d8f4a6bd90',
         | 
| 15 | 
            +
                                 'idigbio_media': 'e3276fdd-ce58-40dc-bf20-8742f7634428',
         | 
| 16 | 
            +
                                 'organism': 'Prunus oocarpa',
         | 
| 17 | 
            +
                                 'intrageneric_group': 'Paleotropical racemose'}]
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            table_header = """**Example Guide**
         | 
| 20 | 
            +
            | Image | Species | Link to iDigBio Specimen Record | Intrageneric group |
         | 
| 21 | 
            +
            | --- | --- | --- | --- |
         | 
| 22 | 
            +
            """
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            table_body = ''
         | 
| 25 | 
            +
            for example in example_metadata:
         | 
| 26 | 
            +
              image_src = f"<image src = 'https://api.idigbio.org/v2/media/{example['idigbio_media']}?size=thumbnail'></image>"
         | 
| 27 | 
            +
              species = f"*{example['organism']}*"
         | 
| 28 | 
            +
              idigbio_link = f"https://www.idigbio.org/portal/records/{example['idigbio_specimen']}"
         | 
| 29 | 
            +
              intrageneric_group = example['intrageneric_group']
         | 
| 30 | 
            +
              table_row = ' | '.join([image_src, species, 
         | 
| 31 | 
            +
                                      idigbio_link, intrageneric_group])
         | 
| 32 | 
            +
              table_body += table_row + '\n'
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            example_table = table_header + table_body
         | 
| 35 |  | 
| 36 | 
             
            example_list = ["examples/myrtifolia_1c086296-6d1f-4218-a18a-ca2f86c295d0.jpg",
         | 
| 37 | 
             
                            "examples/oleifolia_104f44c9-63f1-4579-93c2-54c6ddeddeda.jpg",
         | 
|  | |
| 48 | 
             
                                examples=example_list,
         | 
| 49 | 
             
                                description="This model can place herbarium sheet images from the genus Prunus into one of four categories that represent key clades within the genus: Solitary/Corymbose, Temperate Racemose, Neotropical Racemose, Paleotropical Racemose.",
         | 
| 50 | 
             
                                title="Image classification of four major lineages in the plum genus",
         | 
| 51 | 
            +
                                article=example_table)
         | 
| 52 |  | 
| 53 | 
             
            demo.launch()
         | 
