Spaces:
Runtime error
Runtime error
support_mobile (#1)
Browse files- feat: support mobile (3f3325163fe8be3d656f39ea61d71a0f07f79bb9)
- fix: deps (cf0a76b26d633183ec5a033dd779a7abe0358404)
- fix: locale (dd686d4de14080c3df50e74db083437bf07017b5)
Files changed (4)
- app.css+1-1
- app.py+26-25
- config.py+7
- requirements.txt+1-1
5 unmodified lines67891011121314155 unmodified lines}.right_panel {margin: 20px;margin-top: 66px;border: 1px solid #BFBFC4;border-radius: 8px;}.render_header {5 unmodified lines67891011121314155 unmodified lines}.right_panel {margin-top: 66px;border: 1px solid #BFBFC4;border-radius: 8px;overflow: hidden;;}.render_header {
11 unmodified lines1213141516171857 unmodified lines76777879808182838485868788899091929394959697989910010110210310435 unmodified lines14014114214314414514614714814915015115215315415515615715842 unmodified lines20120220320420520611 unmodified linesimport modelscope_studio.components.base as msimport modelscope_studio.components.legacy as legacyimport modelscope_studio.components.pro as proimport modelscope_studio.components.antd as antdfrom config import DEMO_LIST, SystemPrompt57 unmodified linesdef demo_card_click(e: gr.EventData):index = e._data['component']['index']return DEMO_LIST[index]['description']with gr.Blocks(css_paths="app.css") as demo:history = gr.State([])setting = gr.State({"system": SystemPrompt,})with ms.Application():with antd.ConfigProvider(locale="zh_CN"):with antd.Splitter():with antd.SplitterPanel(default_size="30%", max="70%", min="10%", elem_style={"padding": "20px"}):with antd.Flex(vertical=True, gap="large", wrap=True):header = gr.HTML("""<div class="left_header"><img src="//img.alicdn.com/imgextra/i2/O1CN01KDhOma1DUo8oa7OIU_!!6000000000220-1-tps-240-240.gif" width="200px" /><h1>Qwen2.5-Coder</h2></div>""")# input = antd.InputTextarea(# size="large", allow_clear=True, show_count=True, placeholder="请输入您想要一个什么样的应用")input = gr.TextArea(placeholder="Please enter what kind of application you want", show_label=False, container=False)btn = antd.Button("send", type="primary", size="large")clear_btn = antd.Button("clear history", type="default", size="large")antd.Divider("examples")with antd.Flex(gap="small", wrap=True):with ms.Each(DEMO_LIST):35 unmodified lineshistory_drawer.close(lambda: gr.update(open=False), inputs=[], outputs=[history_drawer])with antd.SplitterPanel(elem_classes="right_panel"):gr.HTML('<div class="render_header"><span class="header_btn"></span><span class="header_btn"></span><span class="header_btn"></span></div>')with antd.Tabs(active_key="empty", render_tab_bar="() => null") as state_tab:with antd.Tabs.Item(key="empty"):empty = antd.Empty(description="empty input", elem_classes="right_content")with antd.Tabs.Item(key="loading"):loading = antd.Spin(True, tip="coding...", size="large", elem_classes="right_content")with antd.Tabs.Item(key="render"):sandbox = gr.HTML(elem_classes="html_content")# sandbox = pro.FrontendCodeSandbox(elem_style={# 'height': '920px',# 'width': '100%'# })def generation_code(query: Optional[str], _setting: Dict[str, str], _history: Optional[History]):if query is None:42 unmodified linesoutputs=[code_output, history, sandbox, state_tab, code_drawer])clear_btn.click(clear_history, inputs=[], outputs=[history])if __name__ == "__main__":demo.queue(default_concurrency_limit=20).launch(ssr_mode=False)11 unmodified lines12131415161757 unmodified lines7576777879808182838485868788899091929394959697989910010110210310435 unmodified lines14014114214314414514614714814915015115215315415515615715815942 unmodified lines20220320420520620711 unmodified linesimport modelscope_studio.components.base as msimport modelscope_studio.components.legacy as legacyimport modelscope_studio.components.antd as antdfrom config import DEMO_LIST, SystemPrompt57 unmodified linesdef demo_card_click(e: gr.EventData):index = e._data['component']['index']return DEMO_LIST[index]['description']with gr.Blocks(css_paths="app.css") as demo:history = gr.State([])setting = gr.State({"system": SystemPrompt,})with ms.Application() as app:with antd.ConfigProvider():with antd.Row(gutter=[32, 12]) as layout:with antd.Col(span=24, md=8):with antd.Flex(vertical=True, gap="middle", wrap=True):header = gr.HTML("""<div class="left_header"><img src="//img.alicdn.com/imgextra/i2/O1CN01KDhOma1DUo8oa7OIU_!!6000000000220-1-tps-240-240.gif" width="200px" /><h1>Qwen2.5-Coder</h2></div>""")input = antd.InputTextarea(size="large", allow_clear=True, placeholder="Please enter what kind of application you want")# input = gr.TextArea(placeholder="请输入您想要一个什么样的应用", show_label=False, container=False)btn = antd.Button("send", type="primary", size="large")clear_btn = antd.Button("clear history", type="default", size="large")antd.Divider("examples")with antd.Flex(gap="small", wrap=True):with ms.Each(DEMO_LIST):35 unmodified lineshistory_drawer.close(lambda: gr.update(open=False), inputs=[], outputs=[history_drawer])with antd.Col(span=24, md=16):with ms.Div(elem_classes="right_panel"):gr.HTML('<div class="render_header"><span class="header_btn"></span><span class="header_btn"></span><span class="header_btn"></span></div>')with antd.Tabs(active_key="empty", render_tab_bar="() => null") as state_tab:with antd.Tabs.Item(key="empty"):empty = antd.Empty(description="empty input", elem_classes="right_content")with antd.Tabs.Item(key="loading"):loading = antd.Spin(True, tip="coding...", size="large", elem_classes="right_content")with antd.Tabs.Item(key="render"):sandbox = gr.HTML(elem_classes="html_content")# sandbox = pro.FrontendCodeSandbox(elem_style={# 'height': '920px',# 'width': '100%'# })def generation_code(query: Optional[str], _setting: Dict[str, str], _history: Optional[History]):if query is None:42 unmodified linesoutputs=[code_output, history, sandbox, state_tab, code_drawer])clear_btn.click(clear_history, inputs=[], outputs=[history])if __name__ == "__main__":demo.queue(default_concurrency_limit=20).launch()
40 unmodified lines41424344454640 unmodified lines"card": {"index": 1,},"title": "TODO list","description": "I want a TODO list that allows me to add tasks, delete tasks, and I would like the overall color theme to be purple."},40 unmodified lines4142434445464748495051525340 unmodified lines"card": {"index": 1,},"title": "Spam with emojis!","description": "Write code in a single HTML file: Capture the click event, place a random number of emojis at the click position, and add gravity and collision effects to each emoji."},{"card": {"index": 2,},"title": "TODO list","description": "I want a TODO list that allows me to add tasks, delete tasks, and I would like the overall color theme to be purple."},
12dashscopehttps://modelscope-demo-widget.oss-cn-zhangjiakou.aliyuncs.com/modelscope_studio-1.0.0b2-py3-none-any.whl12dashscopemodelscope_studio~=1.0.0b
app.css+1-1
app.py+26-25
config.py+7
requirements.txt+1-1