Spaces:
Runtime error
Runtime error
Commit
·
0d65b5f
1
Parent(s):
d7a7bd0
Create funciones.py
Browse files- funciones.py +13 -0
funciones.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def clasifica_imagen(inp):
|
| 2 |
+
inp = inp.reshape((-1,224,224,3))
|
| 3 |
+
inp = tf.keras.applications.mobilenet_v2.preprocess_input(inp)
|
| 4 |
+
prediction = inception_net.predict(inp).flatten()
|
| 5 |
+
confidences ={etiquetas[i]: float(prediction[i]) for i in range(1000)}
|
| 6 |
+
return confidences
|
| 7 |
+
|
| 8 |
+
def audio_a_text(audio):
|
| 9 |
+
text = trans(audio)['text']
|
| 10 |
+
return text
|
| 11 |
+
|
| 12 |
+
def texto_a_sentimiento(text):
|
| 13 |
+
return clasificador(text)[0]['label']
|