Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -49,9 +49,9 @@ def zero_shot(image, text_input):
|
|
49 |
return {dic["label"]: dic["score"] for dic in res}
|
50 |
|
51 |
def shot(image, labels_text):
|
52 |
-
PIL_image = Image.fromarray(np.uint8(image)).convert('RGB')
|
53 |
labels = labels_text.split(",")
|
54 |
-
res = pipe(images=
|
55 |
candidate_labels=labels,
|
56 |
hypothesis_template= "This is a photo of a {}")
|
57 |
return {dic["label"]: dic["score"] for dic in res}
|
@@ -68,7 +68,7 @@ with gr.Blocks() as demo:
|
|
68 |
audio_file =[
|
69 |
gr.Audio(source="microphone", type="filepath", optional=True),
|
70 |
gr.Audio(source="upload", type="filepath", optional=True)]
|
71 |
-
text = gr.Textbox(placeholder="If you dont want to record or upload your voice you can input text here")
|
72 |
with gr.Row():
|
73 |
speech_to_text = gr.Button("Speech to text go brrr", css={"margin-top": "1em"})
|
74 |
with gr.Column():
|
@@ -82,7 +82,7 @@ with gr.Blocks() as demo:
|
|
82 |
with gr.Row():
|
83 |
get_image_latent = gr.Button("Generate Image go brr")
|
84 |
with gr.Column():
|
85 |
-
text_input = gr.Textbox(placeholder="input a list of labels separated by commas")
|
86 |
label = gr.Label()
|
87 |
with gr.Row():
|
88 |
zero_shot_clf = gr.Button("Classify Image go brr")
|
|
|
49 |
return {dic["label"]: dic["score"] for dic in res}
|
50 |
|
51 |
def shot(image, labels_text):
|
52 |
+
#PIL_image = Image.fromarray(np.uint8(image)).convert('RGB')
|
53 |
labels = labels_text.split(",")
|
54 |
+
res = pipe(images= image,
|
55 |
candidate_labels=labels,
|
56 |
hypothesis_template= "This is a photo of a {}")
|
57 |
return {dic["label"]: dic["score"] for dic in res}
|
|
|
68 |
audio_file =[
|
69 |
gr.Audio(source="microphone", type="filepath", optional=True),
|
70 |
gr.Audio(source="upload", type="filepath", optional=True)]
|
71 |
+
text = gr.Textbox(label="Text", placeholder="If you dont want to record or upload your voice you can input text here")
|
72 |
with gr.Row():
|
73 |
speech_to_text = gr.Button("Speech to text go brrr", css={"margin-top": "1em"})
|
74 |
with gr.Column():
|
|
|
82 |
with gr.Row():
|
83 |
get_image_latent = gr.Button("Generate Image go brr")
|
84 |
with gr.Column():
|
85 |
+
text_input = gr.Textbox(label="Candidate labels", placeholder="input a list of labels separated by commas")
|
86 |
label = gr.Label()
|
87 |
with gr.Row():
|
88 |
zero_shot_clf = gr.Button("Classify Image go brr")
|