Spaces:
Runtime error
Runtime error
Commit
·
a80deed
1
Parent(s):
5b3efff
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,32 +1,5 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
import requests
|
| 6 |
-
|
| 7 |
-
# Obteniendo las labels de "https://git.io/JJkYN"
|
| 8 |
-
respuesta = requests.get("https://git.io/JJkYN")
|
| 9 |
-
etiquetas =respuesta.text.split("\n")
|
| 10 |
-
|
| 11 |
-
def classify_imagen(inp):
|
| 12 |
-
inp = inp.reshape((-1, 224, 224, 3))
|
| 13 |
-
inp = tf.keras.applications.mobilenet_v2.preprocess_input(inp)
|
| 14 |
-
# Modificacion en reshape, para que funcione con decode_predictions
|
| 15 |
-
prediction = inception_net.predict(inp).reshape(1,1000)
|
| 16 |
-
# Nuevo metodo para etiquetar predicciones
|
| 17 |
-
pred_labels = tf.keras.applications.mobilenet_v2.decode_predictions(prediction, top=100)
|
| 18 |
-
confidence = {f'{pred_labels[0][i][1]}': float(pred_labels[0][i][2]) for i in range(100)}
|
| 19 |
-
|
| 20 |
-
return confidence
|
| 21 |
-
|
| 22 |
-
def audio_a_text(audio):
|
| 23 |
-
text = trans(audio)["text"]
|
| 24 |
-
return text
|
| 25 |
-
|
| 26 |
-
def texto_a_sentimiento(text):
|
| 27 |
-
return clasificador(text)[0]["label"]
|
| 28 |
-
|
| 29 |
-
|
| 30 |
|
| 31 |
demo = gr.Blocks()
|
| 32 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from functions import audio_a_text, texto_a_sentimiento, classify_imagen
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
demo = gr.Blocks()
|
| 5 |
|