Spaces:
Runtime error
Runtime error
import requests | |
# Obteniendo las labels de "https://git.io/JJkYN" | |
respuesta = requests.get("https://git.io/JJkYN") | |
etiquetas =respuesta.text.split("\n") | |
def classify_imagen(inp): | |
inp = inp.reshape((-1, 224, 224, 3)) | |
inp = tf.keras.applications.mobilenet_v2.preprocess_input(inp) | |
# Modificacion en reshape, para que funcione con decode_predictions | |
prediction = inception_net.predict(inp).reshape(1,1000) | |
# Nuevo metodo para etiquetar predicciones | |
pred_labels = tf.keras.applications.mobilenet_v2.decode_predictions(prediction, top=100) | |
confidence = {f'{pred_labels[0][i][1]}': float(pred_labels[0][i][2]) for i in range(100)} | |
return confidence | |
def audio_a_text(audio): | |
text = trans(audio)["text"] | |
return text | |
def texto_a_sentimiento(text): | |
return clasificador(text)[0]["label"] |