Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,11 +7,11 @@ pipe = pipeline('zero-shot-classification', model=model)
|
|
7 |
def infer(text, classes, multi_label):
|
8 |
output = pipe(text, classes, multi_label=multi_label)
|
9 |
print(output)
|
10 |
-
return output
|
11 |
|
12 |
text_input = gr.Textbox(lines=5, placeholder='Once upon a time...', label='Text Source', show_label=True)
|
13 |
class_input = gr.Textbox(value='positive,negative', label='Class Label', show_label=True)
|
14 |
allow_multi_label = gr.Checkbox(value=True, label='Multiple True Classes')
|
15 |
|
16 |
-
app = gr.Interface(fn=infer, inputs=[text_input, class_input, allow_multi_label], outputs=
|
17 |
app.launch()
|
|
|
7 |
def infer(text, classes, multi_label):
|
8 |
output = pipe(text, classes, multi_label=multi_label)
|
9 |
print(output)
|
10 |
+
return dict(zip(output['labels'], output['scores']))
|
11 |
|
12 |
text_input = gr.Textbox(lines=5, placeholder='Once upon a time...', label='Text Source', show_label=True)
|
13 |
class_input = gr.Textbox(value='positive,negative', label='Class Label', show_label=True)
|
14 |
allow_multi_label = gr.Checkbox(value=True, label='Multiple True Classes')
|
15 |
|
16 |
+
app = gr.Interface(fn=infer, inputs=[text_input, class_input, allow_multi_label], outputs='label')
|
17 |
app.launch()
|