File size: 827 Bytes
503a577
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import React from 'react'
import AudioPlayer from './AudioPlayer'
import type { ExamplesData } from './Examples'

interface GalleryProps {
  selectedModel: string
  selectedAttack: string
  examples: {
    [model: string]: {
      [attack: string]: ExamplesData[]
    }
  }
}

const AudioGallery: React.FC<GalleryProps> = ({ selectedModel, selectedAttack, examples }) => {
  const exampleItems = examples[selectedModel][selectedAttack]
  return (
    <div className="example-display">
      {exampleItems.map((item, index) => (
        <div key={index} className="example-item">
          <p>{item.name}</p>
          {item.audio_url && <AudioPlayer src={item.audio_url} />}
          <img src={item.image_url} alt={item.name} className="example-image" />
        </div>
      ))}
    </div>
  )
}

export default AudioGallery