modelscope-studio 0.4.1__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/PKG-INFO +1 -1
  2. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Chatbot/__init__.py +5 -3
  3. modelscope_studio-0.5.0/backend/modelscope_studio/components/Chatbot/__init__.pyi +585 -0
  4. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Chatbot/templates/component/index.js +28707 -28654
  5. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Flow/__init__.py +1 -2
  6. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Flow/__init__.pyi +62 -54
  7. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Lifecycle/__init__.py +1 -1
  8. modelscope_studio-0.5.0/backend/modelscope_studio/components/Lifecycle/__init__.pyi +230 -0
  9. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Markdown/__init__.py +4 -2
  10. modelscope_studio-0.5.0/backend/modelscope_studio/components/Markdown/__init__.pyi +218 -0
  11. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Markdown/templates/component/index.js +28977 -28925
  12. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Markdown/templates/example/index.js +27781 -27745
  13. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/MultimodalInput/__init__.py +1 -1
  14. modelscope_studio-0.5.0/backend/modelscope_studio/components/MultimodalInput/__init__.pyi +514 -0
  15. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/WaterfallGallery/__init__.py +1 -1
  16. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/WaterfallGallery/__init__.pyi +92 -89
  17. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/utils/process_links.py +2 -2
  18. modelscope_studio-0.5.0/backend/modelscope_studio/version.py +1 -0
  19. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/pyproject.toml +1 -1
  20. modelscope_studio-0.5.0/tests/modelscope_studio2/components/Chatbot/__init__.pyi +585 -0
  21. modelscope_studio-0.5.0/tests/modelscope_studio2/components/Flow/__init__.pyi +276 -0
  22. modelscope_studio-0.5.0/tests/modelscope_studio2/components/Lifecycle/__init__.pyi +230 -0
  23. modelscope_studio-0.5.0/tests/modelscope_studio2/components/Markdown/__init__.pyi +218 -0
  24. modelscope_studio-0.5.0/tests/modelscope_studio2/components/MultimodalInput/__init__.pyi +514 -0
  25. modelscope_studio-0.5.0/tests/modelscope_studio2/components/WaterfallGallery/__init__.pyi +481 -0
  26. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/affix/__init__.pyi +105 -0
  27. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/alert/__init__.pyi +110 -0
  28. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/alert/error_boundary/__init__.pyi +108 -0
  29. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/anchor/__init__.pyi +197 -0
  30. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/anchor/item/__init__.pyi +60 -0
  31. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/auto_complete/__init__.pyi +387 -0
  32. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/auto_complete/option/__init__.pyi +67 -0
  33. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/avatar/__init__.pyi +113 -0
  34. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/avatar/group/__init__.pyi +93 -0
  35. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/badge/__init__.pyi +66 -0
  36. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/badge/ribbon/__init__.pyi +58 -0
  37. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/breadcrumb/__init__.pyi +63 -0
  38. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/breadcrumb/item/__init__.pyi +523 -0
  39. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/button/__init__.pyi +183 -0
  40. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/button/group/__init__.pyi +56 -0
  41. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/calendar/__init__.pyi +200 -0
  42. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/card/__init__.pyi +225 -0
  43. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/card/grid/__init__.pyi +113 -0
  44. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/card/meta/__init__.pyi +73 -0
  45. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/carousel/__init__.pyi +59 -0
  46. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/cascader/__init__.pyi +274 -0
  47. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/cascader/option/__init__.pyi +67 -0
  48. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/cascader/panel/__init__.pyi +173 -0
  49. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/checkbox/__init__.pyi +114 -0
  50. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/checkbox/group/__init__.pyi +138 -0
  51. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/checkbox/group/option/__init__.pyi +69 -0
  52. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/collapse/__init__.pyi +135 -0
  53. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/collapse/item/__init__.pyi +110 -0
  54. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/color_picker/__init__.pyi +312 -0
  55. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/color_picker/preset/__init__.pyi +67 -0
  56. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/config_provider/__init__.pyi +61 -0
  57. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/date_picker/__init__.pyi +279 -0
  58. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/date_picker/preset/__init__.pyi +65 -0
  59. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/date_picker/range_picker/__init__.pyi +271 -0
  60. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/descriptions/__init__.pyi +66 -0
  61. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/descriptions/item/__init__.pyi +63 -0
  62. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/divider/__init__.pyi +86 -0
  63. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/drawer/__init__.pyi +113 -0
  64. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/dropdown/__init__.pyi +291 -0
  65. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/dropdown/button/__init__.pyi +339 -0
  66. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/empty/__init__.pyi +61 -0
  67. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/flex/__init__.pyi +85 -0
  68. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/float_button/__init__.pyi +108 -0
  69. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/float_button/back_top/__init__.pyi +107 -0
  70. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/float_button/group/__init__.pyi +152 -0
  71. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/form/__init__.pyi +256 -0
  72. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/form/item/__init__.pyi +67 -0
  73. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/form/item/rule/__init__.pyi +55 -0
  74. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/grid/col/__init__.pyi +108 -0
  75. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/grid/row/__init__.pyi +84 -0
  76. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/icon/__init__.pyi +142 -0
  77. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/icon/iconfont_provider/__init__.pyi +55 -0
  78. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/image/__init__.pyi +203 -0
  79. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/image/preview_group/__init__.pyi +197 -0
  80. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/input/__init__.pyi +211 -0
  81. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/input/otp/__init__.pyi +114 -0
  82. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/input/password/__init__.pyi +255 -0
  83. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/input/search/__init__.pyi +256 -0
  84. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/input/textarea/__init__.pyi +204 -0
  85. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/input_number/__init__.pyi +215 -0
  86. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/layout/__init__.pyi +115 -0
  87. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/layout/content/__init__.pyi +105 -0
  88. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/layout/footer/__init__.pyi +105 -0
  89. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/layout/header/__init__.pyi +105 -0
  90. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/layout/sider/__init__.pyi +195 -0
  91. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/list/__init__.pyi +154 -0
  92. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/list/item/__init__.pyi +65 -0
  93. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/list/item/meta/__init__.pyi +61 -0
  94. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/mentions/__init__.pyi +387 -0
  95. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/mentions/option/__init__.pyi +71 -0
  96. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/menu/__init__.pyi +250 -0
  97. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/menu/item/__init__.pyi +110 -0
  98. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/message/__init__.pyi +157 -0
  99. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/modal/__init__.pyi +163 -0
  100. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/notification/__init__.pyi +155 -0
  101. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/pagination/__init__.pyi +160 -0
  102. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/popconfirm/__init__.pyi +250 -0
  103. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/popover/__init__.pyi +108 -0
  104. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/progress/__init__.pyi +60 -0
  105. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/qr_code/__init__.pyi +107 -0
  106. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/radio/__init__.pyi +124 -0
  107. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/radio/button/__init__.pyi +120 -0
  108. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/radio/group/__init__.pyi +128 -0
  109. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/radio/group/option/__init__.pyi +73 -0
  110. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/rate/__init__.pyi +295 -0
  111. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/result/__init__.pyi +59 -0
  112. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/segmented/__init__.pyi +121 -0
  113. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/segmented/option/__init__.pyi +63 -0
  114. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/select/__init__.pyi +463 -0
  115. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/select/option/__init__.pyi +69 -0
  116. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/skeleton/__init__.pyi +66 -0
  117. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/skeleton/avatar/__init__.pyi +56 -0
  118. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/skeleton/button/__init__.pyi +56 -0
  119. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/skeleton/image/__init__.pyi +56 -0
  120. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/skeleton/input/__init__.pyi +56 -0
  121. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/skeleton/node/__init__.pyi +56 -0
  122. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/slider/__init__.pyi +178 -0
  123. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/slider/mark/__init__.pyi +71 -0
  124. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/space/__init__.pyi +62 -0
  125. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/space/compact/__init__.pyi +55 -0
  126. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/spin/__init__.pyi +63 -0
  127. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/statistic/__init__.pyi +64 -0
  128. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/statistic/countdown/__init__.pyi +155 -0
  129. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/steps/__init__.pyi +108 -0
  130. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/steps/item/__init__.pyi +59 -0
  131. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/switch/__init__.pyi +160 -0
  132. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/table/__init__.pyi +180 -0
  133. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/table/column/__init__.pyi +111 -0
  134. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/table/column_group/__init__.pyi +63 -0
  135. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/table/expandable/__init__.pyi +161 -0
  136. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/table/row_selection/__init__.pyi +360 -0
  137. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/table/row_selection/selection/__init__.pyi +114 -0
  138. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/tabs/__init__.pyi +254 -0
  139. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/tabs/item/__init__.pyi +59 -0
  140. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/tag/__init__.pyi +113 -0
  141. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/tag/checkable_tag/__init__.pyi +115 -0
  142. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/time_picker/__init__.pyi +214 -0
  143. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/time_picker/range_picker/__init__.pyi +271 -0
  144. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/timeline/__init__.pyi +62 -0
  145. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/timeline/item/__init__.pyi +59 -0
  146. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/tooltip/__init__.pyi +108 -0
  147. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/tour/__init__.pyi +208 -0
  148. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/tour/step/__init__.pyi +199 -0
  149. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/transfer/__init__.pyi +274 -0
  150. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/tree/__init__.pyi +582 -0
  151. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/tree/directory_tree/__init__.pyi +579 -0
  152. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/tree/tree_node/__init__.pyi +63 -0
  153. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/tree_select/__init__.pyi +356 -0
  154. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/tree_select/tree_node/__init__.pyi +65 -0
  155. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/typography/link/__init__.pyi +342 -0
  156. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/typography/paragraph/__init__.pyi +480 -0
  157. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/typography/text/__init__.pyi +435 -0
  158. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/typography/title/__init__.pyi +480 -0
  159. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/upload/__init__.pyi +371 -0
  160. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/upload/base.pyi +367 -0
  161. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/upload/dragger/__init__.pyi +368 -0
  162. modelscope_studio-0.5.0/tests/modelscope_studio2/components/antd/watermark/__init__.pyi +58 -0
  163. modelscope_studio-0.5.0/tests/modelscope_studio2/components/base/application/__init__.pyi +135 -0
  164. modelscope_studio-0.5.0/tests/modelscope_studio2/components/base/div/__init__.pyi +430 -0
  165. modelscope_studio-0.5.0/tests/modelscope_studio2/components/base/each/__init__.pyi +69 -0
  166. modelscope_studio-0.5.0/tests/modelscope_studio2/components/base/filter/__init__.pyi +48 -0
  167. modelscope_studio-0.5.0/tests/modelscope_studio2/components/base/fragment/__init__.pyi +54 -0
  168. modelscope_studio-0.5.0/tests/modelscope_studio2/components/base/slot/__init__.pyi +96 -0
  169. modelscope_studio-0.5.0/tests/modelscope_studio2/components/base/span/__init__.pyi +430 -0
  170. modelscope_studio-0.5.0/tests/modelscope_studio2/components/base/text/__init__.pyi +66 -0
  171. {modelscope_studio-0.4.1/backend/modelscope_studio/components → modelscope_studio-0.5.0/tests/modelscope_studio2/components/legacy}/Chatbot/__init__.pyi +91 -86
  172. modelscope_studio-0.5.0/tests/modelscope_studio2/components/legacy/Flow/__init__.pyi +279 -0
  173. {modelscope_studio-0.4.1/backend/modelscope_studio/components → modelscope_studio-0.5.0/tests/modelscope_studio2/components/legacy}/Lifecycle/__init__.pyi +57 -53
  174. {modelscope_studio-0.4.1/backend/modelscope_studio/components → modelscope_studio-0.5.0/tests/modelscope_studio2/components/legacy}/Markdown/__init__.pyi +40 -35
  175. {modelscope_studio-0.4.1/backend/modelscope_studio/components → modelscope_studio-0.5.0/tests/modelscope_studio2/components/legacy}/MultimodalInput/__init__.pyi +125 -120
  176. modelscope_studio-0.5.0/tests/modelscope_studio2/components/legacy/WaterfallGallery/__init__.pyi +489 -0
  177. modelscope_studio-0.4.1/backend/modelscope_studio/components/Chatbot/templates/example/index.js +0 -112
  178. modelscope_studio-0.4.1/backend/modelscope_studio/components/Chatbot/templates/example/style.css +0 -1
  179. modelscope_studio-0.4.1/backend/modelscope_studio/version.py +0 -1
  180. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/.gitignore +0 -0
  181. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/LICENSE +0 -0
  182. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/README.md +0 -0
  183. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/__init__.py +0 -0
  184. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Chatbot/llm_thinking_presets.py +0 -0
  185. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Chatbot/templates/component/index-D9i0iVhN.js +0 -0
  186. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Chatbot/templates/component/style.css +0 -0
  187. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Flow/edge.py +0 -0
  188. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Flow/node.py +0 -0
  189. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Flow/node_schema.py +0 -0
  190. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Flow/templates/component/index.js +0 -0
  191. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Flow/templates/component/style.css +0 -0
  192. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Lifecycle/templates/component/index.js +0 -0
  193. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Lifecycle/templates/component/style.css +0 -0
  194. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Markdown/templates/component/index-D9i0iVhN.js +0 -0
  195. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Markdown/templates/component/style.css +0 -0
  196. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Markdown/templates/example/index-D9i0iVhN.js +0 -0
  197. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/Markdown/templates/example/style.css +0 -0
  198. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/MultimodalInput/templates/component/index.js +0 -0
  199. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/MultimodalInput/templates/component/style.css +0 -0
  200. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/MultimodalInput/templates/example/index.js +0 -0
  201. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/MultimodalInput/templates/example/style.css +0 -0
  202. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/WaterfallGallery/templates/component/index.js +0 -0
  203. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/WaterfallGallery/templates/component/style.css +0 -0
  204. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/components/__init__.py +0 -0
  205. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/external.py +0 -0
  206. {modelscope_studio-0.4.1 → modelscope_studio-0.5.0}/backend/modelscope_studio/utils/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: modelscope_studio
3
- Version: 0.4.1
3
+ Version: 0.5.0
4
4
  Summary: A set of extension component, inluding components for conversational input and display in multimodal scenarios, as well as more components for vertical scenarios.
5
5
  Author-email: YOUR NAME <YOUREMAIL@domain.com>
6
6
  License-Expression: Apache-2.0
@@ -11,9 +11,8 @@ from gradio.events import Events
11
11
  from gradio_client import utils as client_utils
12
12
  from gradio_client.documentation import document, set_documentation_group
13
13
 
14
- from modelscope_studio.components.MultimodalInput import MultimodalInputData
15
- from modelscope_studio.utils import (CustomComponentDict, process_links,
16
- resolve_frontend_dir)
14
+ from ...utils import CustomComponentDict, process_links, resolve_frontend_dir
15
+ from ..MultimodalInput import MultimodalInputData
17
16
 
18
17
 
19
18
  class FileMessage(GradioModel):
@@ -105,6 +104,7 @@ class ModelScopeChatbot(Component):
105
104
  enable_base64: bool = False,
106
105
  enable_latex: bool = True,
107
106
  latex_single_dollar_delimiter: bool = True,
107
+ latex_delimiters: list[dict[str, str | bool]] | None = None,
108
108
  preview: bool = True,
109
109
  llm_thinking_presets: List[dict] = [],
110
110
  data_postprocess: Callable | None = None,
@@ -126,6 +126,7 @@ class ModelScopeChatbot(Component):
126
126
  height: height of the component in pixels.
127
127
  enable_latex: If True, will enable LaTeX rendering.
128
128
  latex_single_dollar_delimiter: If True, will enable single dollar delimiter for LaTeX rendering.
129
+ latex_delimiters: A list of dicts of the form {"left": open delimiter (str), "right": close delimiter (str), "display": whether to display in newline (bool), "inline": whether to render inline (bool)} that will be used to render LaTeX expressions. For more information, see the [KaTeX documentation](https://katex.org/docs/autorender.html).
129
130
  rtl: If True, sets the direction of the rendered text to right-to-left. Default is False, which renders text left-to-right.
130
131
  show_share_button: If True, will show a share icon in the corner of the component that allows user to share outputs. If False, icon does not appear.
131
132
  show_copy_button: If True, will show a copy button for each chatbot message.
@@ -150,6 +151,7 @@ class ModelScopeChatbot(Component):
150
151
  self.rtl = rtl
151
152
  self.enable_latex = enable_latex
152
153
  self.latex_single_dollar_delimiter = latex_single_dollar_delimiter
154
+ self.latex_delimiters = latex_delimiters
153
155
  self.show_share_button = show_share_button
154
156
  self.render_markdown = render_markdown
155
157
  self.show_copy_button = show_copy_button
@@ -0,0 +1,585 @@
1
+ from __future__ import annotations
2
+
3
+ import inspect
4
+ from pathlib import Path
5
+ from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Union
6
+
7
+ from gradio import processing_utils
8
+ from gradio.components.base import Component
9
+ from gradio.data_classes import FileData, GradioModel, GradioRootModel
10
+ from gradio.events import Events
11
+ from gradio_client import utils as client_utils
12
+ from gradio_client.documentation import document, set_documentation_group
13
+
14
+ from ...utils import CustomComponentDict, process_links, resolve_frontend_dir
15
+ from ..MultimodalInput import MultimodalInputData
16
+
17
+ class FileMessage(GradioModel):
18
+ file: FileData
19
+ alt_text: Optional[str] = None
20
+
21
+
22
+ class MultimodalMessage(GradioModel):
23
+ # By default, message index is used as id. it will cause the message to be re-rendered when id changed.
24
+ id: Optional[str] = None
25
+ # elem id of message container
26
+ elem_id: Optional[str] = None
27
+ # elem classes of message container
28
+ elem_classes: Optional[Union[List[str], str]] = None
29
+ name: Optional[str] = None
30
+ text: Optional[str] = ''
31
+ flushing: Optional[bool] = None
32
+ avatar: Optional[Union[str, FileData]] = ''
33
+ files: Optional[List[Union[FileMessage, dict, FileData, str, Path]]] = None
34
+
35
+
36
+ MultimodalMessageItem = Optional[Union[MultimodalMessage, MultimodalInputData,
37
+ dict, str]]
38
+
39
+
40
+ class ChatbotData(GradioRootModel):
41
+ root: List[Tuple[Union[MultimodalMessageItem, List[MultimodalMessageItem]],
42
+ Union[MultimodalMessageItem,
43
+ List[MultimodalMessageItem]]]]
44
+
45
+
46
+ set_documentation_group("component")
47
+
48
+ from gradio.events import Dependency
49
+
50
+ @document()
51
+ class ModelScopeChatbot(Component):
52
+ """
53
+ Displays a chatbot output showing both user submitted messages and responses. Supports a subset of Markdown including bold, italics, code, tables. Also supports audio/video/image files, which are displayed in the MultimodalChatbot, and other kinds of files which are displayed as links.
54
+ Preprocessing: passes the messages in the MultimodalChatbot as a {List[List[str | None | Tuple]]}, i.e. a list of lists. The inner list has 2 elements: the user message and the response message. See `Postprocessing` for the format of these messages.
55
+ Postprocessing: expects function to return a {List[List[str | None | Tuple]]}, i.e. a list of lists. The inner list should have 2 elements: the user message and the response message. The individual messages can be (1) strings in valid Markdown, (2) tuples if sending files: (a filepath or URL to a file, [optional string alt text]) -- if the file is image/video/audio, it is displayed in the MultimodalChatbot, or (3) None, in which case the message is not displayed.
56
+
57
+ Demos: chatbot_simple, chatbot_multimodal
58
+ Guides: creating-a-chatbot
59
+ """
60
+ FRONTEND_DIR = resolve_frontend_dir("Chatbot")
61
+ EVENTS = [Events.change, Events.select, Events.like, 'flushed', 'custom']
62
+ data_model = ChatbotData
63
+
64
+ @staticmethod
65
+ def data_postprocess(component_instance, value):
66
+ return value
67
+
68
+ @staticmethod
69
+ def data_preprocess(component_instance, value):
70
+ return value
71
+
72
+ def __init__(
73
+ self,
74
+ value: List[List[str | tuple[str] | tuple[str | Path, str] | None]]
75
+ | Callable | None = None,
76
+ *,
77
+ label: str | None = None,
78
+ every: float | None = None,
79
+ show_label: bool | None = None,
80
+ container: bool = True,
81
+ scale: int | None = None,
82
+ min_width: int = 160,
83
+ visible: bool = True,
84
+ elem_id: str | None = None,
85
+ elem_classes: List[str] | str | None = None,
86
+ render: bool = True,
87
+ height: int | None = None,
88
+ rtl: bool = False,
89
+ show_share_button: bool | None = None,
90
+ show_copy_button: bool = False,
91
+ avatar_images: tuple[str | Path | None | dict | list | tuple,
92
+ str | Path | None | dict | list | tuple]
93
+ | None = None,
94
+ avatar_image_align: Literal['top', 'middle', 'bottom'] = 'bottom',
95
+ avatar_image_width: Union[int, Literal['auto']] = 45,
96
+ sanitize_html: bool = True,
97
+ render_markdown: bool = True,
98
+ bubble_full_width: bool = True,
99
+ line_breaks: bool = True,
100
+ likeable: bool = False,
101
+ layout: Literal["panel", "bubble"] | None = None,
102
+ flushing: bool = True,
103
+ flushing_speed: int = 5,
104
+ enable_base64: bool = False,
105
+ enable_latex: bool = True,
106
+ latex_single_dollar_delimiter: bool = True,
107
+ latex_delimiters: list[dict[str, str | bool]] | None = None,
108
+ preview: bool = True,
109
+ llm_thinking_presets: List[dict] = [],
110
+ data_postprocess: Callable | None = None,
111
+ data_preprocess: Callable | None = None,
112
+ custom_components: Dict[str, CustomComponentDict] | None = None):
113
+ """
114
+ Parameters:
115
+ value: Default value to show in chatbot. If callable, the function will be called whenever the app loads to set the initial value of the component.
116
+ label: The label for this component. Appears above the component and is also used as the header if there are a table of examples for this component. If None and used in a `gr.Interface`, the label will be the name of the parameter this component is assigned to.
117
+ every: If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. Queue must be enabled. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
118
+ show_label: if True, will display label.
119
+ container: If True, will place the component in a container - providing some extra padding around the border.
120
+ scale: relative width compared to adjacent Components in a Row. For example, if Component A has scale=2, and Component B has scale=1, A will be twice as wide as B. Should be an integer.
121
+ min_width: minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
122
+ visible: If False, component will be hidden.
123
+ elem_id: An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
124
+ elem_classes: An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.
125
+ render: If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.
126
+ height: height of the component in pixels.
127
+ enable_latex: If True, will enable LaTeX rendering.
128
+ latex_single_dollar_delimiter: If True, will enable single dollar delimiter for LaTeX rendering.
129
+ latex_delimiters: A list of dicts of the form {"left": open delimiter (str), "right": close delimiter (str), "display": whether to display in newline (bool), "inline": whether to render inline (bool)} that will be used to render LaTeX expressions. For more information, see the [KaTeX documentation](https://katex.org/docs/autorender.html).
130
+ rtl: If True, sets the direction of the rendered text to right-to-left. Default is False, which renders text left-to-right.
131
+ show_share_button: If True, will show a share icon in the corner of the component that allows user to share outputs. If False, icon does not appear.
132
+ show_copy_button: If True, will show a copy button for each chatbot message.
133
+ avatar_images: Tuple of two avatar image paths or URLs or dict ("avatar" and "name") or list (each item receives the previous parameters) for user(s) and bot(s) (in that order). Pass None for either the user or bot image to skip. Must be within the working directory of the Gradio app or an external URL and use `gr.update` to update.
134
+ sanitize_html: If False, will disable HTML sanitization for chatbot messages. This is not recommended, as it can lead to security vulnerabilities.
135
+ avatar_image_width: Width of the avatar image in pixels, pass in `auto` to automatically stretch in each message.
136
+ avatar_image_align: Aligns the avatar images to the top, middle, or bottom of the message.
137
+ render_markdown: If False, will disable Markdown rendering for chatbot messages.
138
+ bubble_full_width: If False, the chat bubble will fit to the content of the message. If True (default), the chat bubble will be the full width of the component.
139
+ line_breaks: If True (default), will enable Github-flavored Markdown line breaks in chatbot messages. If False, single new lines will be ignored. Only applies if `render_markdown` is True.
140
+ likeable: Whether the chat messages display a like or dislike button. Set automatically by the .like method but has to be present in the signature for it to show up in the config.
141
+ layout: If "panel", will display the chatbot in a llm style layout. If "bubble", will display the chatbot with message bubbles, with the user and bot messages on alterating sides. Will default to "bubble".
142
+ flushing: If True (default), will stream output the chatbot (not the user) messages to the frontend linearly when they are updated. Can be configured for each message.
143
+ flushing_speed: Range 1 to 10, default is 5.
144
+ llm_thinking_presets: llm presets, imported from modelscope_studio.Chatbot.llm_thinking_presets .
145
+ enable_base64: Enable base64 encoding for markdown rendering.
146
+ preview: If True (default), will enable image preview.
147
+ custom_components: Define custom tags for markdown rendering.
148
+ """
149
+ self.likeable = likeable
150
+ self.height = height
151
+ self.rtl = rtl
152
+ self.enable_latex = enable_latex
153
+ self.latex_single_dollar_delimiter = latex_single_dollar_delimiter
154
+ self.latex_delimiters = latex_delimiters
155
+ self.show_share_button = show_share_button
156
+ self.render_markdown = render_markdown
157
+ self.show_copy_button = show_copy_button
158
+ self.sanitize_html = sanitize_html
159
+ self.bubble_full_width = bubble_full_width
160
+ self.line_breaks = line_breaks
161
+ self.layout = layout
162
+ self.flushing = flushing
163
+ self.flushing_speed = flushing_speed
164
+ self.preview = preview
165
+ self.avatar_image_width = avatar_image_width
166
+ self.enable_base64 = enable_base64
167
+ self.data_preprocess = data_preprocess
168
+ self.data_postprocess = data_postprocess
169
+ self.llm_thinking_presets = llm_thinking_presets
170
+ self.custom_components = custom_components
171
+ super().__init__(
172
+ label=label,
173
+ every=every,
174
+ show_label=show_label,
175
+ container=container,
176
+ scale=scale,
177
+ min_width=min_width,
178
+ visible=visible,
179
+ elem_id=elem_id,
180
+ elem_classes=elem_classes,
181
+ render=render,
182
+ value=value,
183
+ )
184
+ self.avatar_images = avatar_images or [None, None]
185
+ self.avatar_image_align = avatar_image_align
186
+
187
+ if avatar_images is None:
188
+ pass
189
+ else:
190
+ if len(self.avatar_images) != 2:
191
+ raise ValueError(
192
+ "Expected avatar_images to be a tuple of length 2.")
193
+ for i, avatar_image_item in enumerate(self.avatar_images):
194
+ if isinstance(avatar_image_item, (list, tuple)):
195
+ for j, avatar_image in enumerate(avatar_image_item):
196
+ self.avatar_images[i][j] = self._process_avatar_image(
197
+ avatar_image)
198
+ else:
199
+ self.avatar_images[i] = self._process_avatar_image(
200
+ avatar_image_item)
201
+
202
+ def _process_avatar_image(self, avatar_image: str | dict):
203
+ if isinstance(avatar_image, dict):
204
+ avatar_image[
205
+ "avatar"] = processing_utils.move_resource_to_block_cache(
206
+ avatar_image.get("avatar"), self)
207
+ elif isinstance(avatar_image, str):
208
+ avatar_image = processing_utils.move_resource_to_block_cache(
209
+ avatar_image, self)
210
+ return avatar_image
211
+
212
+ def _preprocess_chat_messages(
213
+ self, chat_message: MultimodalMessage | str | dict | None
214
+ ) -> MultimodalMessage | None:
215
+ if chat_message is None:
216
+ return None
217
+ if isinstance(chat_message, dict):
218
+ chat_message = MultimodalMessage(**chat_message)
219
+ if isinstance(chat_message, MultimodalMessage):
220
+ if chat_message.avatar and isinstance(chat_message.avatar, str):
221
+ chat_message.avatar = FileData(
222
+ path=chat_message.avatar,
223
+ orig_name=Path(chat_message.avatar).name,
224
+ size=Path(chat_message.avatar).stat().st_size)
225
+ if chat_message.files is not None and len(chat_message.files) > 0:
226
+ for i, file in enumerate(chat_message.files):
227
+ if isinstance(file, FileData):
228
+ chat_message.files[i] = FileMessage(file=file)
229
+ elif isinstance(file, str):
230
+ chat_message.files[i] = FileMessage(
231
+ file=FileData(path=file,
232
+ orig_name=Path(file).name,
233
+ size=Path(file).stat().st_size))
234
+ elif isinstance(file, dict):
235
+ chat_message.files[i] = FileMessage(file=FileData(
236
+ **file))
237
+ return chat_message
238
+ else:
239
+ return chat_message
240
+ elif isinstance(chat_message, str):
241
+ return MultimodalMessage(text=chat_message)
242
+ else:
243
+ raise ValueError(
244
+ f"Invalid message for Chatbot component: {chat_message}")
245
+
246
+ def preprocess(
247
+ self,
248
+ payload: ChatbotData | None,
249
+ ) -> List[List[MultimodalMessage | None]]:
250
+ if self.data_preprocess:
251
+ payload = self.data_preprocess(self, payload)
252
+ payload = self.__class__.data_preprocess(self, payload)
253
+ if payload is None:
254
+ return payload
255
+ processed_messages = []
256
+ for message_pair in payload.root:
257
+ if not isinstance(message_pair, (tuple, list)):
258
+ raise TypeError(
259
+ "Expected a list of lists or list of tuples. Received: " +
260
+ message_pair)
261
+ if len(message_pair) != 2:
262
+ raise TypeError(
263
+ "Expected a list of lists of length 2 or list of tuples of length 2. Received: "
264
+ + {message_pair})
265
+ processed_message = []
266
+ for message in message_pair:
267
+ processed_message.append([
268
+ self._preprocess_chat_messages(message_item)
269
+ for message_item in message
270
+ ] if isinstance(message, (
271
+ tuple, list)) else self._preprocess_chat_messages(message))
272
+
273
+ processed_messages.append(processed_message)
274
+ return processed_messages
275
+
276
+ def _postprocess_chat_messages(
277
+ self, chat_message: MultimodalMessage | MultimodalInputData | str
278
+ | dict | None
279
+ ) -> MultimodalMessage | None:
280
+ if chat_message is None:
281
+ return None
282
+ if isinstance(chat_message, MultimodalInputData):
283
+ chat_message = dict(text=chat_message.text,
284
+ files=chat_message.files)
285
+ if isinstance(chat_message, str):
286
+ chat_message = dict(text=chat_message)
287
+ if isinstance(chat_message, dict):
288
+ chat_message = MultimodalMessage(**chat_message)
289
+ chat_message.text = process_links(inspect.cleandoc(chat_message.text),
290
+ self)
291
+ if chat_message.avatar:
292
+ if isinstance(chat_message.avatar, str):
293
+ mime_type = client_utils.get_mimetype(chat_message.avatar)
294
+ chat_message.avatar = FileData(
295
+ path=chat_message.avatar,
296
+ orig_name=Path(chat_message.avatar).name,
297
+ size=Path(chat_message.avatar).stat().st_size,
298
+ mime_type=mime_type)
299
+ # Fix Gradio
300
+ chat_message.avatar.url = None
301
+
302
+ if chat_message.files:
303
+ for i, file in enumerate(chat_message.files):
304
+ new_file = file
305
+ if isinstance(file, str):
306
+ mime_type = client_utils.get_mimetype(file)
307
+ new_file = FileMessage(
308
+ file=FileData(path=file,
309
+ orig_name=Path(file).name,
310
+ size=Path(file).stat().st_size,
311
+ mime_type=mime_type))
312
+ elif isinstance(file, Path):
313
+ mime_type = client_utils.get_mimetype(str(file))
314
+ new_file = FileMessage(
315
+ file=FileData(path=str(file),
316
+ orig_name=file.name,
317
+ size=file.stat().st_size,
318
+ mime_type=mime_type))
319
+ elif isinstance(file, FileData):
320
+ new_file = FileMessage(file=file.model_copy())
321
+ elif isinstance(file, dict):
322
+ new_file = FileMessage(file=FileData(**file))
323
+ new_file.file.mime_type = client_utils.get_mimetype(
324
+ new_file.file.path)
325
+ # Fix Gradio
326
+ new_file.file.url = None
327
+ chat_message.files[i] = new_file
328
+
329
+ return chat_message
330
+
331
+ def postprocess(
332
+ self,
333
+ value: List[List[str | dict | MultimodalInputData | MultimodalMessage
334
+ | None] | tuple],
335
+ ) -> ChatbotData:
336
+ if self.data_postprocess:
337
+ value = self.data_postprocess(self, value)
338
+ value = self.__class__.data_postprocess(self, value)
339
+ if value is None:
340
+ return ChatbotData(root=[])
341
+ processed_messages = []
342
+ for message_pair in value:
343
+ if not isinstance(message_pair, (tuple, list)):
344
+ raise TypeError(
345
+ "Expected a list of lists or list of tuples. Received: " +
346
+ message_pair)
347
+ if len(message_pair) != 2:
348
+ raise TypeError(
349
+ "Expected a list of lists of length 2 or list of tuples of length 2. Received: "
350
+ + {message_pair})
351
+ processed_message = []
352
+ for message in message_pair:
353
+ processed_message.append([
354
+ self._postprocess_chat_messages(message_item)
355
+ for message_item in message
356
+ ] if isinstance(message, (
357
+ tuple,
358
+ list)) else self._postprocess_chat_messages(message))
359
+
360
+ processed_messages.append(processed_message)
361
+ return ChatbotData(root=processed_messages)
362
+
363
+ def example_inputs(self) -> Any:
364
+ return [[{
365
+ "text": "Hello!!",
366
+ "files": []
367
+ }, {
368
+ "text": "Hello!!",
369
+ "flushing": False
370
+ }]]
371
+ from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
372
+ from gradio.blocks import Block
373
+ if TYPE_CHECKING:
374
+ from gradio.components import Timer
375
+
376
+
377
+ def change(self,
378
+ fn: Callable[..., Any] | None = None,
379
+ inputs: Block | Sequence[Block] | set[Block] | None = None,
380
+ outputs: Block | Sequence[Block] | None = None,
381
+ api_name: str | None | Literal[False] = None,
382
+ scroll_to_output: bool = False,
383
+ show_progress: Literal["full", "minimal", "hidden"] = "full",
384
+ queue: bool | None = None,
385
+ batch: bool = False,
386
+ max_batch_size: int = 4,
387
+ preprocess: bool = True,
388
+ postprocess: bool = True,
389
+ cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
390
+ every: Timer | float | None = None,
391
+ trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
392
+ js: str | None = None,
393
+ concurrency_limit: int | None | Literal["default"] = "default",
394
+ concurrency_id: str | None = None,
395
+ show_api: bool = True) -> Dependency:
396
+ """
397
+ Parameters:
398
+ fn: the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
399
+ inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
400
+ outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
401
+ api_name: defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
402
+ scroll_to_output: if True, will scroll to output component on completion
403
+ show_progress: how to show the progress animation while event is running: "full" shows a spinner which covers the output component area as well as a runtime display in the upper right corner, "minimal" only shows the runtime display, "hidden" shows no progress animation at all
404
+ queue: if True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
405
+ batch: if True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
406
+ max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
407
+ preprocess: if False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
408
+ postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
409
+ cancels: a list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
410
+ every: continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.
411
+ trigger_mode: if "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()` events) would allow a second submission after the pending event is complete.
412
+ js: optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
413
+ concurrency_limit: if set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
414
+ concurrency_id: if set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
415
+ show_api: whether to show this event in the "view API" page of the Gradio app, or in the ".view_api()" method of the Gradio clients. Unlike setting api_name to False, setting show_api to False will still allow downstream apps as well as the Clients to use this event. If fn is None, show_api will automatically be set to False.
416
+ """
417
+ ...
418
+
419
+ def select(self,
420
+ fn: Callable[..., Any] | None = None,
421
+ inputs: Block | Sequence[Block] | set[Block] | None = None,
422
+ outputs: Block | Sequence[Block] | None = None,
423
+ api_name: str | None | Literal[False] = None,
424
+ scroll_to_output: bool = False,
425
+ show_progress: Literal["full", "minimal", "hidden"] = "full",
426
+ queue: bool | None = None,
427
+ batch: bool = False,
428
+ max_batch_size: int = 4,
429
+ preprocess: bool = True,
430
+ postprocess: bool = True,
431
+ cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
432
+ every: Timer | float | None = None,
433
+ trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
434
+ js: str | None = None,
435
+ concurrency_limit: int | None | Literal["default"] = "default",
436
+ concurrency_id: str | None = None,
437
+ show_api: bool = True) -> Dependency:
438
+ """
439
+ Parameters:
440
+ fn: the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
441
+ inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
442
+ outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
443
+ api_name: defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
444
+ scroll_to_output: if True, will scroll to output component on completion
445
+ show_progress: how to show the progress animation while event is running: "full" shows a spinner which covers the output component area as well as a runtime display in the upper right corner, "minimal" only shows the runtime display, "hidden" shows no progress animation at all
446
+ queue: if True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
447
+ batch: if True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
448
+ max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
449
+ preprocess: if False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
450
+ postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
451
+ cancels: a list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
452
+ every: continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.
453
+ trigger_mode: if "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()` events) would allow a second submission after the pending event is complete.
454
+ js: optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
455
+ concurrency_limit: if set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
456
+ concurrency_id: if set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
457
+ show_api: whether to show this event in the "view API" page of the Gradio app, or in the ".view_api()" method of the Gradio clients. Unlike setting api_name to False, setting show_api to False will still allow downstream apps as well as the Clients to use this event. If fn is None, show_api will automatically be set to False.
458
+ """
459
+ ...
460
+
461
+ def like(self,
462
+ fn: Callable[..., Any] | None = None,
463
+ inputs: Block | Sequence[Block] | set[Block] | None = None,
464
+ outputs: Block | Sequence[Block] | None = None,
465
+ api_name: str | None | Literal[False] = None,
466
+ scroll_to_output: bool = False,
467
+ show_progress: Literal["full", "minimal", "hidden"] = "full",
468
+ queue: bool | None = None,
469
+ batch: bool = False,
470
+ max_batch_size: int = 4,
471
+ preprocess: bool = True,
472
+ postprocess: bool = True,
473
+ cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
474
+ every: Timer | float | None = None,
475
+ trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
476
+ js: str | None = None,
477
+ concurrency_limit: int | None | Literal["default"] = "default",
478
+ concurrency_id: str | None = None,
479
+ show_api: bool = True) -> Dependency:
480
+ """
481
+ Parameters:
482
+ fn: the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
483
+ inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
484
+ outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
485
+ api_name: defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
486
+ scroll_to_output: if True, will scroll to output component on completion
487
+ show_progress: how to show the progress animation while event is running: "full" shows a spinner which covers the output component area as well as a runtime display in the upper right corner, "minimal" only shows the runtime display, "hidden" shows no progress animation at all
488
+ queue: if True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
489
+ batch: if True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
490
+ max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
491
+ preprocess: if False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
492
+ postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
493
+ cancels: a list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
494
+ every: continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.
495
+ trigger_mode: if "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()` events) would allow a second submission after the pending event is complete.
496
+ js: optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
497
+ concurrency_limit: if set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
498
+ concurrency_id: if set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
499
+ show_api: whether to show this event in the "view API" page of the Gradio app, or in the ".view_api()" method of the Gradio clients. Unlike setting api_name to False, setting show_api to False will still allow downstream apps as well as the Clients to use this event. If fn is None, show_api will automatically be set to False.
500
+ """
501
+ ...
502
+
503
+ def flushed(self,
504
+ fn: Callable[..., Any] | None = None,
505
+ inputs: Block | Sequence[Block] | set[Block] | None = None,
506
+ outputs: Block | Sequence[Block] | None = None,
507
+ api_name: str | None | Literal[False] = None,
508
+ scroll_to_output: bool = False,
509
+ show_progress: Literal["full", "minimal", "hidden"] = "full",
510
+ queue: bool | None = None,
511
+ batch: bool = False,
512
+ max_batch_size: int = 4,
513
+ preprocess: bool = True,
514
+ postprocess: bool = True,
515
+ cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
516
+ every: Timer | float | None = None,
517
+ trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
518
+ js: str | None = None,
519
+ concurrency_limit: int | None | Literal["default"] = "default",
520
+ concurrency_id: str | None = None,
521
+ show_api: bool = True) -> Dependency:
522
+ """
523
+ Parameters:
524
+ fn: the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
525
+ inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
526
+ outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
527
+ api_name: defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
528
+ scroll_to_output: if True, will scroll to output component on completion
529
+ show_progress: how to show the progress animation while event is running: "full" shows a spinner which covers the output component area as well as a runtime display in the upper right corner, "minimal" only shows the runtime display, "hidden" shows no progress animation at all
530
+ queue: if True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
531
+ batch: if True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
532
+ max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
533
+ preprocess: if False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
534
+ postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
535
+ cancels: a list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
536
+ every: continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.
537
+ trigger_mode: if "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()` events) would allow a second submission after the pending event is complete.
538
+ js: optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
539
+ concurrency_limit: if set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
540
+ concurrency_id: if set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
541
+ show_api: whether to show this event in the "view API" page of the Gradio app, or in the ".view_api()" method of the Gradio clients. Unlike setting api_name to False, setting show_api to False will still allow downstream apps as well as the Clients to use this event. If fn is None, show_api will automatically be set to False.
542
+ """
543
+ ...
544
+
545
+ def custom(self,
546
+ fn: Callable[..., Any] | None = None,
547
+ inputs: Block | Sequence[Block] | set[Block] | None = None,
548
+ outputs: Block | Sequence[Block] | None = None,
549
+ api_name: str | None | Literal[False] = None,
550
+ scroll_to_output: bool = False,
551
+ show_progress: Literal["full", "minimal", "hidden"] = "full",
552
+ queue: bool | None = None,
553
+ batch: bool = False,
554
+ max_batch_size: int = 4,
555
+ preprocess: bool = True,
556
+ postprocess: bool = True,
557
+ cancels: dict[str, Any] | list[dict[str, Any]] | None = None,
558
+ every: Timer | float | None = None,
559
+ trigger_mode: Literal["once", "multiple", "always_last"] | None = None,
560
+ js: str | None = None,
561
+ concurrency_limit: int | None | Literal["default"] = "default",
562
+ concurrency_id: str | None = None,
563
+ show_api: bool = True) -> Dependency:
564
+ """
565
+ Parameters:
566
+ fn: the function to call when this event is triggered. Often a machine learning model's prediction function. Each parameter of the function corresponds to one input component, and the function should return a single value or a tuple of values, with each element in the tuple corresponding to one output component.
567
+ inputs: list of gradio.components to use as inputs. If the function takes no inputs, this should be an empty list.
568
+ outputs: list of gradio.components to use as outputs. If the function returns no outputs, this should be an empty list.
569
+ api_name: defines how the endpoint appears in the API docs. Can be a string, None, or False. If False, the endpoint will not be exposed in the api docs. If set to None, the endpoint will be exposed in the api docs as an unnamed endpoint, although this behavior will be changed in Gradio 4.0. If set to a string, the endpoint will be exposed in the api docs with the given name.
570
+ scroll_to_output: if True, will scroll to output component on completion
571
+ show_progress: how to show the progress animation while event is running: "full" shows a spinner which covers the output component area as well as a runtime display in the upper right corner, "minimal" only shows the runtime display, "hidden" shows no progress animation at all
572
+ queue: if True, will place the request on the queue, if the queue has been enabled. If False, will not put this event on the queue, even if the queue has been enabled. If None, will use the queue setting of the gradio app.
573
+ batch: if True, then the function should process a batch of inputs, meaning that it should accept a list of input values for each parameter. The lists should be of equal length (and be up to length `max_batch_size`). The function is then *required* to return a tuple of lists (even if there is only 1 output component), with each list in the tuple corresponding to one output component.
574
+ max_batch_size: maximum number of inputs to batch together if this is called from the queue (only relevant if batch=True)
575
+ preprocess: if False, will not run preprocessing of component data before running 'fn' (e.g. leaving it as a base64 string if this method is called with the `Image` component).
576
+ postprocess: if False, will not run postprocessing of component data before returning 'fn' output to the browser.
577
+ cancels: a list of other events to cancel when this listener is triggered. For example, setting cancels=[click_event] will cancel the click_event, where click_event is the return value of another components .click method. Functions that have not yet run (or generators that are iterating) will be cancelled, but functions that are currently running will be allowed to finish.
578
+ every: continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer.
579
+ trigger_mode: if "once" (default for all events except `.change()`) would not allow any submissions while an event is pending. If set to "multiple", unlimited submissions are allowed while pending, and "always_last" (default for `.change()` and `.key_up()` events) would allow a second submission after the pending event is complete.
580
+ js: optional frontend js method to run before running 'fn'. Input arguments for js method are values of 'inputs' and 'outputs', return should be a list of values for output components.
581
+ concurrency_limit: if set, this is the maximum number of this event that can be running simultaneously. Can be set to None to mean no concurrency_limit (any number of this event can be running simultaneously). Set to "default" to use the default concurrency limit (defined by the `default_concurrency_limit` parameter in `Blocks.queue()`, which itself is 1 by default).
582
+ concurrency_id: if set, this is the id of the concurrency group. Events with the same concurrency_id will be limited by the lowest set concurrency_limit.
583
+ show_api: whether to show this event in the "view API" page of the Gradio app, or in the ".view_api()" method of the Gradio clients. Unlike setting api_name to False, setting show_api to False will still allow downstream apps as well as the Clients to use this event. If fn is None, show_api will automatically be set to False.
584
+ """
585
+ ...