Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1248,22 +1248,9 @@ def process_examples(file_name):
|
|
| 1248 |
file_path = f"example_files/{file_name[0]}"
|
| 1249 |
file_path = [file_path]
|
| 1250 |
outputs = variable_outputs(file_path)
|
| 1251 |
-
img = display_trust_score_1()
|
| 1252 |
-
|
| 1253 |
-
|
| 1254 |
-
|
| 1255 |
-
return outputs,img
|
| 1256 |
-
|
| 1257 |
-
def process_examples1(file_name):
|
| 1258 |
-
file_path = f"example_files/{file_name[0]}"
|
| 1259 |
-
file_path = [file_path]
|
| 1260 |
-
outputs = variable_outputs(file_path)
|
| 1261 |
-
img = display_trust_score_2()
|
| 1262 |
-
|
| 1263 |
-
|
| 1264 |
-
|
| 1265 |
-
return outputs,img
|
| 1266 |
|
|
|
|
|
|
|
| 1267 |
|
| 1268 |
|
| 1269 |
def process_datasets(file_inputs):
|
|
@@ -1624,25 +1611,25 @@ def read_ai_dataset_selection():
|
|
| 1624 |
def create_trust_score_1():
|
| 1625 |
score = 8.5
|
| 1626 |
max_score = 10
|
| 1627 |
-
fig, ax = plt.subplots(figsize=(
|
| 1628 |
values = [score, max_score - score]
|
| 1629 |
-
ax.pie(values, colors=["#4CAF50", "#C0C0C0"], startangle=90, counterclock=False, wedgeprops=dict(width=0.
|
| 1630 |
|
| 1631 |
-
plt.text(0, 0, f"{score}/{max_score}", horizontalalignment='center', verticalalignment='center', fontsize=
|
| 1632 |
plt.axis("equal")
|
| 1633 |
-
fig.suptitle('Trust Score 1', fontsize=
|
| 1634 |
return fig
|
| 1635 |
|
| 1636 |
def create_trust_score_2():
|
| 1637 |
score = 7.5
|
| 1638 |
max_score = 10
|
| 1639 |
-
fig, ax = plt.subplots(figsize=(
|
| 1640 |
values = [score, max_score - score]
|
| 1641 |
-
ax.pie(values, colors=["#4CAF50", "#C0C0C0"], startangle=90, counterclock=False, wedgeprops=dict(width=0.
|
| 1642 |
|
| 1643 |
-
plt.text(0, 0, f"{score}/{max_score}", horizontalalignment='center', verticalalignment='center', fontsize=
|
| 1644 |
plt.axis("equal")
|
| 1645 |
-
fig.suptitle('Trust Score 2', fontsize=
|
| 1646 |
return fig
|
| 1647 |
|
| 1648 |
def plot_to_numpy(fig):
|
|
@@ -1782,21 +1769,29 @@ with gr.Blocks() as demo:
|
|
| 1782 |
|
| 1783 |
## All widget functions here ##
|
| 1784 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1785 |
vw_customers_btn.click(
|
| 1786 |
fn=process_examples,
|
| 1787 |
inputs=[vw_customers_state],
|
| 1788 |
-
outputs=
|
| 1789 |
-
|
| 1790 |
)
|
| 1791 |
-
|
| 1792 |
-
|
| 1793 |
vw_prospects_btn.click(
|
| 1794 |
fn=process_examples1,
|
| 1795 |
inputs=[vw_prospects_state],
|
| 1796 |
-
outputs=
|
| 1797 |
)
|
| 1798 |
-
|
| 1799 |
-
|
| 1800 |
|
| 1801 |
radio.change(fn=update_ai_dataset_selection, inputs=radio, outputs=[])
|
| 1802 |
|
|
|
|
| 1248 |
file_path = f"example_files/{file_name[0]}"
|
| 1249 |
file_path = [file_path]
|
| 1250 |
outputs = variable_outputs(file_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1251 |
|
| 1252 |
+
return outputs
|
| 1253 |
+
|
| 1254 |
|
| 1255 |
|
| 1256 |
def process_datasets(file_inputs):
|
|
|
|
| 1611 |
def create_trust_score_1():
|
| 1612 |
score = 8.5
|
| 1613 |
max_score = 10
|
| 1614 |
+
fig, ax = plt.subplots(figsize=(1, 1), subplot_kw=dict(aspect="equal"))
|
| 1615 |
values = [score, max_score - score]
|
| 1616 |
+
ax.pie(values, colors=["#4CAF50", "#C0C0C0"], startangle=90, counterclock=False, wedgeprops=dict(width=0.2))
|
| 1617 |
|
| 1618 |
+
plt.text(0, 0, f"{score}/{max_score}", horizontalalignment='center', verticalalignment='center', fontsize=6)
|
| 1619 |
plt.axis("equal")
|
| 1620 |
+
fig.suptitle('Trust Score 1', fontsize=6)
|
| 1621 |
return fig
|
| 1622 |
|
| 1623 |
def create_trust_score_2():
|
| 1624 |
score = 7.5
|
| 1625 |
max_score = 10
|
| 1626 |
+
fig, ax = plt.subplots(figsize=(1, 1), subplot_kw=dict(aspect="equal"))
|
| 1627 |
values = [score, max_score - score]
|
| 1628 |
+
ax.pie(values, colors=["#4CAF50", "#C0C0C0"], startangle=90, counterclock=False, wedgeprops=dict(width=0.2))
|
| 1629 |
|
| 1630 |
+
plt.text(0, 0, f"{score}/{max_score}", horizontalalignment='center', verticalalignment='center', fontsize=6)
|
| 1631 |
plt.axis("equal")
|
| 1632 |
+
fig.suptitle('Trust Score 2', fontsize=6)
|
| 1633 |
return fig
|
| 1634 |
|
| 1635 |
def plot_to_numpy(fig):
|
|
|
|
| 1769 |
|
| 1770 |
## All widget functions here ##
|
| 1771 |
|
| 1772 |
+
vw_customers_btn.click(
|
| 1773 |
+
fn=display_trust_score_1,
|
| 1774 |
+
inputs=[],
|
| 1775 |
+
outputs=trust_score_output,
|
| 1776 |
+
)
|
| 1777 |
+
|
| 1778 |
+
vw_prospects_btn.click(
|
| 1779 |
+
fn=display_trust_score_2,
|
| 1780 |
+
inputs=[],
|
| 1781 |
+
outputs=trust_score_output,
|
| 1782 |
+
)
|
| 1783 |
+
|
| 1784 |
vw_customers_btn.click(
|
| 1785 |
fn=process_examples,
|
| 1786 |
inputs=[vw_customers_state],
|
| 1787 |
+
outputs= outputs,
|
|
|
|
| 1788 |
)
|
| 1789 |
+
|
|
|
|
| 1790 |
vw_prospects_btn.click(
|
| 1791 |
fn=process_examples1,
|
| 1792 |
inputs=[vw_prospects_state],
|
| 1793 |
+
outputs= outputs,
|
| 1794 |
)
|
|
|
|
|
|
|
| 1795 |
|
| 1796 |
radio.change(fn=update_ai_dataset_selection, inputs=radio, outputs=[])
|
| 1797 |
|