changxin commited on
Commit
ddaf4e0
·
1 Parent(s): f49a98a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -1,6 +1,14 @@
1
  import gradio as gr
2
- def fx(x):
3
- return "你好:"+x
 
 
 
 
 
 
 
 
4
 
5
  title = "测试WEB APP"
6
  description = """
 
1
  import gradio as gr
2
+ import json,pulp
3
+ def fx(x,y):
4
+ m=pulp.LpProblem()
5
+ x=list(map(int,x.split(',')))
6
+ t=[pulp.LpVariable('t'+str(i),cat=pulp.LpBinary) for i in range(len(x))]
7
+ m+=pulp.lpDot(x,t)
8
+ m+=(pulp.lpDot(x,t)==y)
9
+ m.solve()
10
+ resu={'data':[x[i] for i in range(len(t)) if pulp.value(t[i])]}
11
+ return json.dumps(resu, ensure_ascii=False)
12
 
13
  title = "测试WEB APP"
14
  description = """