Update app.py
Browse files
app.py
CHANGED
@@ -14,18 +14,18 @@ def entropy(X):
|
|
14 |
return en
|
15 |
|
16 |
def string_to_list(string):
|
17 |
-
# Divide
|
18 |
substrings = string.split(',')
|
19 |
|
20 |
-
#
|
21 |
response = substrings
|
22 |
return response
|
23 |
|
24 |
def function(valores):
|
25 |
return entropy(string_to_list(valores))
|
26 |
|
27 |
-
value1 = gr.Textbox(lines=3, label="
|
28 |
-
value2 = gr.Textbox(lines=3, label="
|
29 |
|
30 |
examples = [
|
31 |
["1,2,3,4,5,6,7,8,9"],
|
@@ -39,9 +39,9 @@ demo = gr.Interface(
|
|
39 |
fn=function,
|
40 |
inputs=value1,
|
41 |
outputs=value2,
|
42 |
-
title="
|
43 |
examples=examples,
|
44 |
-
description="
|
45 |
)
|
46 |
|
47 |
demo.launch(debug=True)
|
|
|
14 |
return en
|
15 |
|
16 |
def string_to_list(string):
|
17 |
+
# Divide the string into a list of substrings separated by commas
|
18 |
substrings = string.split(',')
|
19 |
|
20 |
+
# Convert each substring to an integer and add to a list
|
21 |
response = substrings
|
22 |
return response
|
23 |
|
24 |
def function(valores):
|
25 |
return entropy(string_to_list(valores))
|
26 |
|
27 |
+
value1 = gr.Textbox(lines=3, label="Values", placeholder="Please enter the values separated by commas...")
|
28 |
+
value2 = gr.Textbox(lines=3, label="Result", placeholder="Result...")
|
29 |
|
30 |
examples = [
|
31 |
["1,2,3,4,5,6,7,8,9"],
|
|
|
39 |
fn=function,
|
40 |
inputs=value1,
|
41 |
outputs=value2,
|
42 |
+
title="Entropy calculator",
|
43 |
examples=examples,
|
44 |
+
description="Calculate the entropy of a set of numbers."
|
45 |
)
|
46 |
|
47 |
demo.launch(debug=True)
|