rubend18 commited on
Commit
98b37dc
·
1 Parent(s): a57669b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -12
app.py CHANGED
@@ -1,10 +1,10 @@
1
  import gradio as gr
2
  import numpy as np
3
 
4
- def entropy(numbers):
5
  n = len(numbers)
6
 
7
- counts = np.bincount(X)
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 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...")
 
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...")