Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -45,7 +45,7 @@ def speech_to_text(mic=None, file=None):
|
|
45 |
|
46 |
def zero_shot(image, text_input):
|
47 |
results = zero(image, text_input)
|
48 |
-
return
|
49 |
|
50 |
with gr.Blocks() as demo:
|
51 |
with gr.Row():
|
@@ -65,16 +65,16 @@ with gr.Blocks() as demo:
|
|
65 |
image = gr.outputs.Image(type="pil", label="Your result")
|
66 |
img = [image,gr.outputs.Carousel(label="Individual images",components=["image"]),gr.outputs.Textbox(label="Error")]
|
67 |
with gr.Row():
|
68 |
-
get_image_latent = gr.Button("Generate Image go brr"
|
69 |
with gr.Column():
|
70 |
text_input = gr.Textbox(placeholder="input a list of labels separated by commas")
|
71 |
label = gr.Label()
|
72 |
with gr.Row():
|
73 |
-
zero_shot_clf = gr.Button("Classify Image go brr"
|
74 |
|
75 |
|
76 |
speech_to_text.click(speech_to_text, inputs=audio_file, outputs=text)
|
77 |
get_image_latent.click(text2image_latent, inputs=[text,steps,width,height,images,diversity], outputs=img)
|
78 |
-
zero_shot_clf.click(zero_shot, inputs=[img,text_input], outputs
|
79 |
|
80 |
demo.launch(enable_queue=False)
|
|
|
45 |
|
46 |
def zero_shot(image, text_input):
|
47 |
results = zero(image, text_input)
|
48 |
+
return {dic["label"]: dic["score"] for dic in results}
|
49 |
|
50 |
with gr.Blocks() as demo:
|
51 |
with gr.Row():
|
|
|
65 |
image = gr.outputs.Image(type="pil", label="Your result")
|
66 |
img = [image,gr.outputs.Carousel(label="Individual images",components=["image"]),gr.outputs.Textbox(label="Error")]
|
67 |
with gr.Row():
|
68 |
+
get_image_latent = gr.Button("Generate Image go brr")
|
69 |
with gr.Column():
|
70 |
text_input = gr.Textbox(placeholder="input a list of labels separated by commas")
|
71 |
label = gr.Label()
|
72 |
with gr.Row():
|
73 |
+
zero_shot_clf = gr.Button("Classify Image go brr")
|
74 |
|
75 |
|
76 |
speech_to_text.click(speech_to_text, inputs=audio_file, outputs=text)
|
77 |
get_image_latent.click(text2image_latent, inputs=[text,steps,width,height,images,diversity], outputs=img)
|
78 |
+
zero_shot_clf.click(zero_shot, inputs=[img[0],text_input], outputs=label)
|
79 |
|
80 |
demo.launch(enable_queue=False)
|