Update app.py
Browse files
app.py
CHANGED
@@ -44,80 +44,49 @@ with demo:
|
|
44 |
gr.Markdown(
|
45 |
"""
|
46 |
<p align="center">
|
47 |
-
<img width=200 src="https://
|
48 |
</p>
|
49 |
"""
|
50 |
)
|
51 |
gr.Markdown(
|
52 |
"""
|
53 |
-
<h1 align="center"
|
54 |
-
<p align="center">
|
55 |
-
<a href="https://github.com/zama-ai/concrete-ml"> <img style="vertical-align: middle; display:inline-block; margin-right: 3px;" width=15 src="file/images/logos/github.png">Concrete-ML</a>
|
56 |
-
—
|
57 |
-
<a href="https://docs.zama.ai/concrete-ml"> <img style="vertical-align: middle; display:inline-block; margin-right: 3px;" width=15 src="file/images/logos/documentation.png">Documentation</a>
|
58 |
-
—
|
59 |
-
<a href="https://zama.ai/community"> <img style="vertical-align: middle; display:inline-block; margin-right: 3px;" width=15 src="file/images/logos/community.png">Community</a>
|
60 |
-
—
|
61 |
-
<a href="https://twitter.com/zama_fhe"> <img style="vertical-align: middle; display:inline-block; margin-right: 3px;" width=15 src="file/images/logos/x.png">@zama_fhe</a>
|
62 |
-
</p>
|
63 |
"""
|
64 |
)
|
65 |
|
66 |
-
with gr.Accordion("
|
67 |
gr.Markdown(
|
68 |
"""
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
- Credit bureaus collect and maintain data on consumers' credit and payment
|
76 |
-
histories. This data includes your past and current debts, payment history, and the
|
77 |
-
length of your credit history.
|
78 |
-
- Credit scoring agencies use algorithms to analyze
|
79 |
-
the data from credit bureaus and generate a credit score. This score is a numerical
|
80 |
-
representation of your creditworthiness.
|
81 |
-
- The bank uses your credit score, along with
|
82 |
-
the information you provided, to make a decision on your credit card application. A
|
83 |
-
higher credit score generally increases your chances of being approved and may result
|
84 |
-
in better terms (like a lower interest rate).
|
85 |
"""
|
86 |
)
|
87 |
|
88 |
-
with gr.Accordion("
|
89 |
gr.Markdown(
|
90 |
"""
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
credit bureaus and scoring agencies. The more entities that have access to your data,
|
95 |
-
the greater the risk of a data breach. This can lead to identity theft and financial
|
96 |
-
fraud. There's also the issue of data accuracy. Mistakes in credit reports can lead to
|
97 |
-
unjustly low credit scores, affecting your ability to get credit.
|
98 |
"""
|
99 |
)
|
100 |
|
101 |
with gr.Accordion(
|
102 |
-
"
|
103 |
open=False,
|
104 |
):
|
105 |
gr.Markdown(
|
106 |
"""
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
thorough and accurate assessment of a person's creditworthiness. Data from various
|
114 |
-
sources can be combined and analyzed to make a more informed decision, yet each party's
|
115 |
-
data remains confidential. As a result, the risk of data leaks or breaches is
|
116 |
-
significantly minimized, addressing major privacy concerns.
|
117 |
-
|
118 |
-
To summarize, FHE provides a means to make more accurate credit eligibility decisions
|
119 |
-
while maintaining strict data privacy, offering a sophisticated solution to the delicate
|
120 |
-
balance between data utility and confidentiality.
|
121 |
"""
|
122 |
)
|
123 |
|
@@ -129,21 +98,18 @@ with demo:
|
|
129 |
"""
|
130 |
)
|
131 |
|
132 |
-
gr.Markdown("##
|
133 |
gr.Markdown("<hr />")
|
134 |
-
gr.Markdown("<span style='color:grey'
|
135 |
gr.Markdown(
|
136 |
"""
|
137 |
-
-
|
138 |
-
|
139 |
-
any other party.
|
140 |
-
- The evaluation key is a public key that the server needs to process encrypted data. It is
|
141 |
-
therefore transmitted to the server for further processing as well.
|
142 |
"""
|
143 |
)
|
144 |
-
keygen_button = gr.Button("
|
145 |
evaluation_key = gr.Textbox(
|
146 |
-
label="
|
147 |
)
|
148 |
client_id = gr.Textbox(label="", max_lines=2, interactive=False, visible=False)
|
149 |
|
@@ -153,31 +119,26 @@ with demo:
|
|
153 |
outputs=[client_id, evaluation_key, keygen_button],
|
154 |
)
|
155 |
|
156 |
-
gr.Markdown("##
|
157 |
gr.Markdown("<hr />")
|
158 |
-
gr.Markdown("<span style='color:grey'
|
159 |
gr.Markdown(
|
160 |
"""
|
161 |
-
|
162 |
-
|
163 |
-
-
|
164 |
-
-
|
165 |
-
applicant's banking information relevant to the decision (here, we consider duration of
|
166 |
-
account);
|
167 |
-
- and credit bureau information, which represents any other information (here,
|
168 |
-
employment history) that could provide additional insight relevant to the decision.
|
169 |
|
170 |
-
|
171 |
-
before running the FHE inference.
|
172 |
"""
|
173 |
)
|
174 |
|
175 |
with gr.Row():
|
176 |
with gr.Column():
|
177 |
-
gr.Markdown("###
|
178 |
bool_inputs = gr.CheckboxGroup(
|
179 |
-
["
|
180 |
-
label="
|
181 |
)
|
182 |
num_children = gr.Slider(
|
183 |
**CHILDREN_MIN_MAX,
|
|
|
44 |
gr.Markdown(
|
45 |
"""
|
46 |
<p align="center">
|
47 |
+
<img width=200 src="https://www.yamu.com/uploads/image/20220602/1d3eb99b96d3a84ef37eda59989e5e2f.png">
|
48 |
</p>
|
49 |
"""
|
50 |
)
|
51 |
gr.Markdown(
|
52 |
"""
|
53 |
+
<h1 align="center">使用全同态加密的信用卡审批预测</h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
"""
|
55 |
)
|
56 |
|
57 |
+
with gr.Accordion("什么是信用卡的审批评估分?", open=False):
|
58 |
gr.Markdown(
|
59 |
"""
|
60 |
+
这是一个复杂的过程,涉及多个实体:申请人、银行、信用中心和信用评分机构。
|
61 |
+
当您申请信用卡时,您会向银行提供个人和财务信息。这可能包括您的收入、就业状况和现有债务。银行使用这些信息来评估您的信用度。
|
62 |
+
为此,他们经常求助于信用中心和信用评分机构。
|
63 |
+
- 信用中心收集并保存有关消费者信用历史的数据。这些数据包括您过去和当前的债务以及您的信用历史长度。
|
64 |
+
- 信用评分机构使用算法来分析来自信用中心的数据并生成信用评分。 该分数是您信用度的数字表示。
|
65 |
+
- 银行使用您的信用评分以及您提供的信息来对您的信用卡申请做出决定。更高的信用评分通常会增加您获得批准的机会,并可能带来更好的条款(例如更低的利率)。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
"""
|
67 |
)
|
68 |
|
69 |
+
with gr.Accordion("为什么在此过程中添加新的隐私计算处理层至关重要?", open=False):
|
70 |
gr.Markdown(
|
71 |
"""
|
72 |
+
因为所涉及的数据高度敏感。它包括个人信息,如您的身份证号码号码、收入和信用记录。
|
73 |
+
不同实体之间有大量数据共享。您的信息不仅���握在银行手中,还掌握在信用中心和评分机构手中。有权访问您数据的实体越多,数据泄露的风险就越大。这可能导致身份盗窃和金融欺诈。还有数据准确性的问题。
|
74 |
+
信用报告中的错误可能导致不公平的低信用评分,影响您获得信贷的能力。
|
|
|
|
|
|
|
|
|
75 |
"""
|
76 |
)
|
77 |
|
78 |
with gr.Accordion(
|
79 |
+
"为什么全同态加密(FHE)是提升信用评分能力的解决方案?",
|
80 |
open=False,
|
81 |
):
|
82 |
gr.Markdown(
|
83 |
"""
|
84 |
+
全同态加密 (FHE) 被视为增强涉及申请人、银行、信用中心和信用评分机构等多方的信用评分流程的隐私和准确性的理想解决方案。
|
85 |
+
它允许对数据进行加密和处理,而无需解密。这意味着可以共享和分析敏感数据,而无需将实际信息暴露给任何一方或处理它的服务器。
|
86 |
+
在信用评分的背景下,这将使对个人信誉的评估更加彻底和准确。可以组合和分析来自各种来源的数据以做出更明智的决策,但每一方的数据仍保持机密。
|
87 |
+
因此,数据泄露或泄露的风险被大大降低,解决了主要的隐私问题。
|
88 |
+
|
89 |
+
总而言之,FHE 提供了一种做出更准确的信贷资格决策的方法,同时保持严格的数据隐私,为数据实用性和机密性之间的微妙平衡提供了一个复杂的解决方案。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
"""
|
91 |
)
|
92 |
|
|
|
98 |
"""
|
99 |
)
|
100 |
|
101 |
+
gr.Markdown("## 第1步:创建密钥。")
|
102 |
gr.Markdown("<hr />")
|
103 |
+
gr.Markdown("<span style='color:grey'>申请人、银行和信贷机构设置</span>")
|
104 |
gr.Markdown(
|
105 |
"""
|
106 |
+
- 私钥由合作计算信用评分的实体共同生成。它用于加密和解密数据,绝不会与任何其他方共享。
|
107 |
+
- 计算密钥(evaluation key)是服务器处理加密数据所需的公钥。因此,它也被传输到服务器进行进一步处理。
|
|
|
|
|
|
|
108 |
"""
|
109 |
)
|
110 |
+
keygen_button = gr.Button("生成密钥并将计算密钥发送到服务器。")
|
111 |
evaluation_key = gr.Textbox(
|
112 |
+
label="计算密钥:", max_lines=2, interactive=False
|
113 |
)
|
114 |
client_id = gr.Textbox(label="", max_lines=2, interactive=False, visible=False)
|
115 |
|
|
|
119 |
outputs=[client_id, evaluation_key, keygen_button],
|
120 |
)
|
121 |
|
122 |
+
gr.Markdown("## 第2步:填写申请信息。")
|
123 |
gr.Markdown("<hr />")
|
124 |
+
gr.Markdown("<span style='color:grey'>申请人、银行和信贷机构设置</span>")
|
125 |
gr.Markdown(
|
126 |
"""
|
127 |
+
选择与您要评估的个人资料相对应的信息。此模型使用了三种信息来源:
|
128 |
+
- 申请人的个人信息,以评估其信用卡资格;
|
129 |
+
- 申请人的银行账户历史记录,其中提供了与该决定相关的任何类型的申请人银行信息(此处,我们考虑开户时间);
|
130 |
+
- 以及信用中心信息,这些信息代表了任何其他信息(这里指就业历史),这些信息可以提供与决策相关的额外见解。
|
|
|
|
|
|
|
|
|
131 |
|
132 |
+
在运行FHE推理之前,请务必在更新后加密并发送值(通过右侧的按钮)。
|
|
|
133 |
"""
|
134 |
)
|
135 |
|
136 |
with gr.Row():
|
137 |
with gr.Column():
|
138 |
+
gr.Markdown("### 第2.1步 - 申请人信息 🧑💼")
|
139 |
bool_inputs = gr.CheckboxGroup(
|
140 |
+
["汽车", "房产", "手机"],
|
141 |
+
label="您目前持有或拥有以下哪些资产?"
|
142 |
)
|
143 |
num_children = gr.Slider(
|
144 |
**CHILDREN_MIN_MAX,
|