File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -32,11 +32,11 @@ The `LocalImage` class is designed to create and handle local image elements to
32
32
### Usage with message scope
33
33
34
34
``` python Code Example
35
- from chainlit import LocalImage
35
+ import chainlit as cl
36
36
37
37
# Sending an image with the local file path
38
38
elements = [
39
- LocalImage(name = " image1" , display = " inline" , path = " ./image1.jpg" )
39
+ cl. LocalImage(name = " image1" , display = " inline" , path = " ./image1.jpg" )
40
40
]
41
41
42
42
cl.Message(content = " Look at this local image!" , elements = elements).send()
@@ -45,15 +45,15 @@ cl.Message(content="Look at this local image!", elements=elements).send()
45
45
### Usage without scope
46
46
47
47
``` python Code Example
48
- from chainlit import LocalImage
48
+ import chainlit as cl
49
49
50
50
# Sending an image with the local file path
51
- image1 = LocalImage(name = " image1" , display = " inline" , path = " ./image1.jpg" )
51
+ image1 = cl. LocalImage(name = " image1" , display = " inline" , path = " ./image1.jpg" )
52
52
image1.send()
53
53
54
54
# Sending an image with file content as bytes
55
55
with open (" ./image2.jpg" , " rb" ) as f:
56
56
image_content = f.read()
57
- image2 = LocalImage(name = " image2" , display = " inline" , content = image_content)
57
+ image2 = cl. LocalImage(name = " image2" , display = " inline" , content = image_content)
58
58
image2.send()
59
59
```
Original file line number Diff line number Diff line change @@ -31,11 +31,11 @@ The `PDF` class allows you to display a pdf hosted remotely or locally in the ch
31
31
### Usage with message scope
32
32
33
33
``` python Code Example
34
- from chainlit import PDF
34
+ import chainlit as cl
35
35
36
36
# Sending a pdf with the local file path
37
37
elements = [
38
- PDF(name = " pdf1" , display = " inline" , path = " ./pdf1.pdf" )
38
+ cl. PDF(name = " pdf1" , display = " inline" , path = " ./pdf1.pdf" )
39
39
]
40
40
41
41
cl.Message(content = " Look at this local pdf!" , elements = elements).send()
@@ -44,15 +44,15 @@ cl.Message(content="Look at this local pdf!", elements=elements).send()
44
44
### Usage without scope
45
45
46
46
``` python Code Example
47
- from chainlit import PDF
47
+ import chainlit as cl
48
48
49
49
# Sending a pdf with the remote url
50
- pdf1 = PDF(name = " pdf1" , display = " inline" , url = " https://example.com/example.pdf" )
50
+ pdf1 = cl. PDF(name = " pdf1" , display = " inline" , url = " https://example.com/example.pdf" )
51
51
pdf1.send()
52
52
53
53
# Sending a pdf with file content as bytes
54
54
with open (" ./pdf2.pdf" , " rb" ) as f:
55
55
pdf_content = f.read()
56
- pdf2 = PDF(name = " pdf2" , display = " inline" , content = pdf_content)
56
+ pdf2 = cl. PDF(name = " pdf2" , display = " inline" , content = pdf_content)
57
57
pdf2.send()
58
58
```
You can’t perform that action at this time.
0 commit comments