Spaces:
Runtime error
Runtime error
Fix Interface Imports
Browse files
utils.py
CHANGED
|
@@ -32,6 +32,20 @@ def text_analysis(text, pipes: list[pipeline]):
|
|
| 32 |
######################
|
| 33 |
##### INTERFACE ######
|
| 34 |
######################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
def token_classification_interface(pipe: pipeline, examples: list[str], output_label: str, title: str, desc: str):
|
| 36 |
return gr.Interface(
|
| 37 |
fn=partial(tagging, pipe=pipe),
|
|
|
|
| 32 |
######################
|
| 33 |
##### INTERFACE ######
|
| 34 |
######################
|
| 35 |
+
def text_interface(pipe: pipeline, examples: list[str], output_label: str, title: str, desc: str):
|
| 36 |
+
return gr.Interface(
|
| 37 |
+
fn=partial(cls_inference, pipe=pipe),
|
| 38 |
+
inputs=[
|
| 39 |
+
gr.Textbox(lines=5, label="Input Text"),
|
| 40 |
+
],
|
| 41 |
+
title=title,
|
| 42 |
+
description=desc,
|
| 43 |
+
outputs=[gr.Label(label=output_label)],
|
| 44 |
+
examples=examples,
|
| 45 |
+
allow_flagging="never",
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
def token_classification_interface(pipe: pipeline, examples: list[str], output_label: str, title: str, desc: str):
|
| 50 |
return gr.Interface(
|
| 51 |
fn=partial(tagging, pipe=pipe),
|