Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,13 +72,13 @@ class ZeroShotCLF():
|
|
| 72 |
|
| 73 |
clf = ZeroShotCLF()
|
| 74 |
|
| 75 |
-
def clasifica(
|
| 76 |
-
clases =
|
| 77 |
-
tipos =
|
| 78 |
if len(tipos) == 1:
|
| 79 |
tipos = tipos[0]
|
| 80 |
textos = clf.set_classes(clases, tipos)
|
| 81 |
probs = clf.predict(PIL.Image.fromarray(imagen))[-1]
|
| 82 |
return {textos[i]: probs[i] for i in range(len(textos))}
|
| 83 |
|
| 84 |
-
gr.Interface(fn=clasifica, inputs=["image", "text", "text"], outputs=
|
|
|
|
| 72 |
|
| 73 |
clf = ZeroShotCLF()
|
| 74 |
|
| 75 |
+
def clasifica(Image, Types, Classes):
|
| 76 |
+
clases = Classes.split(", ")
|
| 77 |
+
tipos = Types.split(", ")
|
| 78 |
if len(tipos) == 1:
|
| 79 |
tipos = tipos[0]
|
| 80 |
textos = clf.set_classes(clases, tipos)
|
| 81 |
probs = clf.predict(PIL.Image.fromarray(imagen))[-1]
|
| 82 |
return {textos[i]: probs[i] for i in range(len(textos))}
|
| 83 |
|
| 84 |
+
gr.Interface(fn=clasifica, inputs=["image", "text", "text"], outputs=gr.components.Label()).launch(share=False)
|