Spaces:
Running
Running
File size: 3,889 Bytes
ed7ca64 | 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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | import gradio as gr
import modelscope_studio.components.antd as antd
import modelscope_studio.components.antdx as antdx
import modelscope_studio.components.base as ms
with gr.Blocks() as demo:
with ms.Application():
with antdx.XProvider():
antd.Divider("File Types")
with antd.Flex(gap="middle", wrap=True):
antdx.FileCard(filename="document.pdf",
type="file",
icon="pdf",
byte=204800)
antdx.FileCard(filename="spreadsheet.xlsx",
type="file",
icon="excel",
byte=102400)
antdx.FileCard(filename="presentation.pptx",
type="file",
icon="ppt",
byte=512000)
antdx.FileCard(filename="report.docx",
type="file",
icon="word",
byte=81920)
antdx.FileCard(filename="archive.zip",
type="file",
icon="zip",
byte=1048576)
antdx.FileCard(filename="README.md",
type="file",
icon="markdown",
byte=4096)
antdx.FileCard(filename="script.py",
type="file",
icon="python",
byte=8192)
antd.Divider("Image Type")
with antd.Flex(gap="middle", wrap=True):
antdx.FileCard(
filename="photo.jpg",
type="image",
src=
"https://gw.alipayobjects.com/zos/antfincdn/aPkFc8Sj7n/method-draw-image.svg",
byte=327680)
antd.Divider("Loading State")
with antd.Flex(gap="middle", wrap=True):
antdx.FileCard(filename="loading-file.pdf",
type="file",
icon="pdf",
loading=True)
antd.Divider("With Description")
with antd.Flex(gap="middle", wrap=True):
antdx.FileCard(filename="notes.txt",
type="file",
description="Last modified today",
byte=2048)
antd.Divider("FileCard.List")
antdx.FileCard.List(items=[{
"filename": "file1.pdf",
"type": "file",
"icon": "pdf",
"byte": 204800
}, {
"filename": "image1.jpg",
"type": "image",
"byte": 327680
}, {
"filename": "audio.mp3",
"type": "audio",
"byte": 5242880
}, {
"filename": "video.mp4",
"type": "video",
"byte": 52428800
}],
removable=True)
antd.Divider("FileCard.List with Custom Items")
with antdx.FileCard.List(removable=True):
antdx.FileCard.List.Item(filename="custom1.xlsx",
type="file",
icon="excel",
byte=102400)
antdx.FileCard.List.Item(filename="custom2.pdf",
type="file",
icon="pdf",
byte=204800)
if __name__ == "__main__":
demo.queue().launch()
|