Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
4 |
-
#!/usr/bin/env python
|
5 |
-
# coding: utf-8
|
6 |
-
|
7 |
import pandas as pd
|
8 |
import math
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
results = None
|
13 |
r_m = []
|
14 |
r_l1 = []
|
15 |
r_l2 = []
|
@@ -91,19 +87,15 @@ else:
|
|
91 |
|
92 |
print(df.to_markdown(tablefmt="grid"))
|
93 |
df.to_csv("result.csv", index=False)
|
|
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
-
def greet(M, L1, L2, LS, A, z, n):
|
97 |
-
return "# 输入参数:" + "-"*82 + "\n" + "|-M: 金属| -L1: 配体1 | -L2: 配体2 | -LS: 含S配体的相对分子质量 | -A: 质谱上对应的分子量 | -z: 电荷 |" + f"M:{M}\nL1:{L1}\nL2:{L2}\nLS:{LS}\nA:{A}\nz:{z}\nn:{n}"
|
98 |
-
|
99 |
-
iface = gr.Interface(fn=greet, inputs=[
|
100 |
-
gr.Textbox(lines=1),
|
101 |
-
gr.Textbox(lines=1),
|
102 |
-
gr.Textbox(lines=1),
|
103 |
-
gr.Textbox(lines=1),
|
104 |
-
gr.Textbox(lines=1),
|
105 |
-
gr.Textbox(lines=1),
|
106 |
-
gr.Textbox(lines=1)
|
107 |
-
|
108 |
-
], outputs="text")
|
109 |
iface.launch()
|
|
|
|
1 |
import gradio as gr
|
2 |
|
|
|
|
|
|
|
|
|
3 |
import pandas as pd
|
4 |
import math
|
5 |
|
6 |
+
def add_variables(M, L1, L2, LS, A, z, n):
|
7 |
+
result = M + L1 + L2 + LS + A + z + n
|
8 |
+
results = None
|
9 |
r_m = []
|
10 |
r_l1 = []
|
11 |
r_l2 = []
|
|
|
87 |
|
88 |
print(df.to_markdown(tablefmt="grid"))
|
89 |
df.to_csv("result.csv", index=False)
|
90 |
+
return df
|
91 |
|
92 |
+
iface = gr.Interface(
|
93 |
+
fn=add_variables,
|
94 |
+
inputs=["number", "number", "number", "number", "number", "number", "number"],
|
95 |
+
outputs="DataFrame",
|
96 |
+
title="MS",
|
97 |
+
description="输入:|-M: 金属| -L1: 配体1 | -L2: 配体2 | -LS: 含S配体的相对分子质量 | -A: 质谱上对应的分子量 | -z: 电荷 |"
|
98 |
+
)
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
iface.launch()
|
101 |
+
|