Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
|
| 4 |
-
def
|
| 5 |
n = len(numbers)
|
| 6 |
|
| 7 |
-
counts = np.bincount(
|
| 8 |
probabilities = counts[np.nonzero(counts)] / n
|
| 9 |
|
| 10 |
entropy_value = 0
|
|
@@ -13,16 +13,9 @@ def entropy(numbers):
|
|
| 13 |
|
| 14 |
return result
|
| 15 |
|
| 16 |
-
def
|
| 17 |
-
|
| 18 |
-
|
| 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...")
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
|
| 4 |
+
def entropy_calculator(numbers):
|
| 5 |
n = len(numbers)
|
| 6 |
|
| 7 |
+
counts = np.bincount(numbers)
|
| 8 |
probabilities = counts[np.nonzero(counts)] / n
|
| 9 |
|
| 10 |
entropy_value = 0
|
|
|
|
| 13 |
|
| 14 |
return result
|
| 15 |
|
| 16 |
+
def function(values):
|
| 17 |
+
substrings = values.split(',')
|
| 18 |
+
return entropy_calculator(substrings)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
value1 = gr.Textbox(lines=3, label="Values", placeholder="Please enter the values separated by commas...")
|
| 21 |
value2 = gr.Textbox(lines=3, label="Result", placeholder="Result...")
|