File size: 2,850 Bytes
db32e48
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176823e
db32e48
 
 
 
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# MutilmodalInput

A multimodal input field that supports uploading files, recording audio, taking photos, etc.

- Supports text input and file upload for joint submission
- Supports image and audio previews during file upload
- Submissions serve as Chatbot input, matching multimodal content as user input questions automatically
- Supports user recording and photography

## How to Use

### Basic Usage

<demo name="basic"></demo>

### Using with Chatbot

<demo name="with_chatbot"></demo>

### Configuring Upload/Submit Buttons

<demo name="config_buttons"></demo>

### Allowing User Recording or Photography

<demo name="upload_sources"></demo>

## API and Parameter List

The following APIs are additional expanded parameters beyond the original gradio Textbox.

### value

Interface definition:

```python
class MultimodalInputData(GradioModel):
    files: List[Union[FileData, str]] = []
    text: str
```

### props

| Attribute           | Type                                            | Default Value | Description                                                                                                                                                                            |
| ------------------- | ----------------------------------------------- | ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| sources             | List[Literal['upload', 'microphone', 'webcam']] | ['upload']    | A list of types for uploading files. "upload" provides an upload file button. "microphone" supports user audio input. "webcam" supports user photography to generate images or videos. |
| webcam_props        | dict                                            | None          | webcam component properties, currently supports passing mirror_webcam(bool), include_audio(bool)                                                                                       |
| upload_button_props | dict                                            | None          | Upload file button properties, same as gradio UploadButton                                                                                                                             |
| submit_button_props | dict                                            | None          | Submit button properties, same as gradio Button                                                                                                                                        |
| file_preview_props  | dict                                            | None          | File preview component properties, currently supports passing height (int)                                                                                                             |