Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -7,6 +7,7 @@ model_dict = {
|
|
7 |
"CNN": CNNDetector,
|
8 |
"fastText": FasttextDetector,
|
9 |
}
|
|
|
10 |
default_model = "fastText"
|
11 |
scenario_number = ["1", "2", "3", "4", "5", "6"]
|
12 |
string_seperator = "|||"
|
@@ -22,8 +23,8 @@ def process_single_text(
|
|
22 |
):
|
23 |
# Split input
|
24 |
prediction_input = text_input.split(string_seperator)
|
25 |
-
if len(prediction_input) >
|
26 |
-
prediction_input = prediction_input[:
|
27 |
|
28 |
# Checking and finalizing scneario number
|
29 |
if not isinstance(scenario_number_choose, int):
|
@@ -65,7 +66,7 @@ with gr.Blocks() as demo:
|
|
65 |
with gr.Column():
|
66 |
input_text = gr.Textbox(
|
67 |
label="Input Text",
|
68 |
-
info=f"Text to determine wether headline or not. For multiple input you can divide each string by '{string_seperator}'. Maximum processed string is
|
69 |
lines=5,
|
70 |
value="""Kami adalah|||\nseorang kapiten|||daitas kamu ada jurang|||\nDITEMUKAN PRIA DIATAS JURANG"""
|
71 |
)
|
|
|
7 |
"CNN": CNNDetector,
|
8 |
"fastText": FasttextDetector,
|
9 |
}
|
10 |
+
num_text_process_limit = 10
|
11 |
default_model = "fastText"
|
12 |
scenario_number = ["1", "2", "3", "4", "5", "6"]
|
13 |
string_seperator = "|||"
|
|
|
23 |
):
|
24 |
# Split input
|
25 |
prediction_input = text_input.split(string_seperator)
|
26 |
+
if len(prediction_input) > num_text_process_limit:
|
27 |
+
prediction_input = prediction_input[:num_text_process_limit]
|
28 |
|
29 |
# Checking and finalizing scneario number
|
30 |
if not isinstance(scenario_number_choose, int):
|
|
|
66 |
with gr.Column():
|
67 |
input_text = gr.Textbox(
|
68 |
label="Input Text",
|
69 |
+
info=f"Text to determine wether headline or not. For multiple input you can divide each string by '{string_seperator}'. Maximum processed string is {num_text_process_limit}.",
|
70 |
lines=5,
|
71 |
value="""Kami adalah|||\nseorang kapiten|||daitas kamu ada jurang|||\nDITEMUKAN PRIA DIATAS JURANG"""
|
72 |
)
|