Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import numpy as np
|
2 |
|
3 |
def entropy(X):
|
@@ -20,27 +21,27 @@ def string_to_list(string):
|
|
20 |
response = substrings
|
21 |
return response
|
22 |
|
23 |
-
# ********************************************************************************
|
24 |
-
# INTERFAZ
|
25 |
-
# ********************************************************************************
|
26 |
-
|
27 |
-
import gradio as gr
|
28 |
-
|
29 |
def function(valores):
|
30 |
return entropy(string_to_list(valores))
|
31 |
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
demo = gr.Interface(
|
39 |
fn=function,
|
40 |
-
inputs=
|
41 |
-
outputs=
|
42 |
title="Calcular entropía",
|
43 |
-
examples=examples
|
|
|
44 |
)
|
45 |
|
46 |
-
demo.launch(
|
|
|
1 |
+
import gradio as gr
|
2 |
import numpy as np
|
3 |
|
4 |
def entropy(X):
|
|
|
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="Valores", placeholder="Ingrese los valores separados por comas...")
|
28 |
+
value2 = gr.Textbox(lines=3, label="Resultado", placeholder="Resultado...")
|
29 |
+
|
30 |
+
examples = [
|
31 |
+
["1,2,3,4,5,6,7,8,9"],
|
32 |
+
["1,1,1,1,1,1,1,1,2"],
|
33 |
+
["1,2,1,2,1,2,1,2,1"],
|
34 |
+
["8,8,8,8,8,8,8,8,8"],
|
35 |
+
["1,2,3,1,2,3,1,2,3"]
|
36 |
+
]
|
37 |
|
38 |
demo = gr.Interface(
|
39 |
fn=function,
|
40 |
+
inputs=value1,
|
41 |
+
outputs=value2,
|
42 |
title="Calcular entropía",
|
43 |
+
examples=examples,
|
44 |
+
description="Calcula la entropía de un conjunto de números"
|
45 |
)
|
46 |
|
47 |
+
demo.launch(debug=True)
|