Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ all_langs = {iso[0]: (iso[1], iso[2], iso[3]) for iso in non_empty_isos} # {'Rom
|
|
| 10 |
iso1toall = {iso[1]: (iso[0], iso[2], iso[3]) for iso in non_empty_isos} # {'ro': ('Romanian', 'rum', 'ron')}
|
| 11 |
DEFAULTS = None
|
| 12 |
|
| 13 |
-
libraries = ["langdetect", "langid"
|
| 14 |
|
| 15 |
class Detect():
|
| 16 |
def __init__(self, text: str) -> None:
|
|
@@ -60,7 +60,7 @@ def detect_language(input_text: str, used_libraries: list[str]) -> tuple[str, st
|
|
| 60 |
|
| 61 |
with gr.Blocks() as interface:
|
| 62 |
gr.Markdown("### Language Detection with Gradio API and MCP Server")
|
| 63 |
-
input_text = gr.Textbox(label="Enter text to detect:", placeholder="Type
|
| 64 |
autofocus=True, submit_btn='Detect Language', max_length=512)
|
| 65 |
# with gr.Row(variant="compact"):
|
| 66 |
# detected_text = gr.Textbox(label="Detected language:", placeholder="Display field for detected language", interactive=False, buttons=["copy"], lines=1)
|
|
@@ -69,10 +69,10 @@ with gr.Blocks() as interface:
|
|
| 69 |
used_libraries = gr.CheckboxGroup(choices=libraries, label="Detection libraries", info="Detection libraries")
|
| 70 |
dataframe = gr.Dataframe(
|
| 71 |
headers=["Language", "Score"],
|
| 72 |
-
datatype=["str", "float"], # type:
|
| 73 |
-
row_count=
|
| 74 |
-
column_count=
|
| 75 |
-
column_limits=(
|
| 76 |
)
|
| 77 |
input_text.submit(
|
| 78 |
fn=detect_language,
|
|
|
|
| 10 |
iso1toall = {iso[1]: (iso[0], iso[2], iso[3]) for iso in non_empty_isos} # {'ro': ('Romanian', 'rum', 'ron')}
|
| 11 |
DEFAULTS = None
|
| 12 |
|
| 13 |
+
libraries = ["langdetect", "langid"]
|
| 14 |
|
| 15 |
class Detect():
|
| 16 |
def __init__(self, text: str) -> None:
|
|
|
|
| 60 |
|
| 61 |
with gr.Blocks() as interface:
|
| 62 |
gr.Markdown("### Language Detection with Gradio API and MCP Server")
|
| 63 |
+
input_text = gr.Textbox(label="Enter text to detect:", placeholder="Type/copy text here, maximum 512 tokens",
|
| 64 |
autofocus=True, submit_btn='Detect Language', max_length=512)
|
| 65 |
# with gr.Row(variant="compact"):
|
| 66 |
# detected_text = gr.Textbox(label="Detected language:", placeholder="Display field for detected language", interactive=False, buttons=["copy"], lines=1)
|
|
|
|
| 69 |
used_libraries = gr.CheckboxGroup(choices=libraries, label="Detection libraries", info="Detection libraries")
|
| 70 |
dataframe = gr.Dataframe(
|
| 71 |
headers=["Language", "Score"],
|
| 72 |
+
datatype=["str", "float"], # type: array
|
| 73 |
+
row_count=len(libraries),
|
| 74 |
+
column_count=2,
|
| 75 |
+
column_limits=(2, 3),
|
| 76 |
)
|
| 77 |
input_text.submit(
|
| 78 |
fn=detect_language,
|