Spaces:
Build error
Build error
import gradio as gr | |
import json,pulp | |
def fx(x,y): | |
m=pulp.LpProblem() | |
x=list(map(int,x.split(','))) | |
t=[pulp.LpVariable('t'+str(i),cat=pulp.LpBinary) for i in range(len(x))] | |
m+=pulp.lpDot(x,t) | |
m+=(pulp.lpDot(x,t)==y) | |
m.solve() | |
resu={'data':[x[i] for i in range(len(t)) if pulp.value(t[i])]} | |
return resu | |
title = "测试WEB APP" | |
description = """ | |
<center> | |
执一以为天下式! | |
<img src="https://pbihub.cn/uploads/images/201809/23/44/n6xk1x6UnN.gif" width=380px> | |
</center> | |
""" | |
article = "加入[组团吹水](https://qm.qq.com/cgi-bin/qm/qr?k=ueJ_sPuOGHOlzSsUC5lVTBdKpQP-PXbO&jump_from=webapi),你不来我不老!" | |
gr.Interface(fn=fx,inputs=[gr.Textbox(placeholder='请输入凑数序列,如"1,3,5,10,16,54,32,48,6,7"',label="请输入待凑数序列",show_label=True),gr.Number(value=80,label="请输入凑数和值",show_label=True)],outputs=gr.JSON(value="",label="输出运算结果",show_label=True),title = title, description = description, article = article).launch() |