Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -1977,7 +1977,7 @@ with gr.Blocks(title="Syntactic Sentence Simplifier") as demo:
|
|
| 1977 |
"(you can edit the text afterwards)."
|
| 1978 |
)
|
| 1979 |
|
| 1980 |
-
#
|
| 1981 |
input_text = gr.Textbox(
|
| 1982 |
lines=12,
|
| 1983 |
label="Original text",
|
|
@@ -1985,18 +1985,19 @@ with gr.Blocks(title="Syntactic Sentence Simplifier") as demo:
|
|
| 1985 |
elem_classes=["input-text"],
|
| 1986 |
)
|
| 1987 |
|
| 1988 |
-
#
|
|
|
|
|
|
|
|
|
|
| 1989 |
output_text = gr.Textbox(
|
| 1990 |
lines=12,
|
| 1991 |
label="Simplified text",
|
| 1992 |
elem_classes=["output-text"],
|
| 1993 |
)
|
| 1994 |
|
| 1995 |
-
# --- ONLY process button ---
|
| 1996 |
-
btn = gr.Button("Process & Simplify", variant="primary")
|
| 1997 |
btn.click(fn=process_text, inputs=input_text, outputs=output_text)
|
| 1998 |
|
| 1999 |
-
#
|
| 2000 |
EXAMPLE_SENTENCES = [
|
| 2001 |
"John kicked the ball and walked to Leeds.",
|
| 2002 |
"John is one test, Mary, who lives in London, loves exams, and Bill eats bread.",
|
|
@@ -2024,8 +2025,8 @@ with gr.Blocks(title="Syntactic Sentence Simplifier") as demo:
|
|
| 2024 |
ex_btn = gr.Button(label, size="sm")
|
| 2025 |
ex_btn.click(
|
| 2026 |
fn=lambda current, s=ex: append_example(current, s),
|
| 2027 |
-
inputs=input_text,
|
| 2028 |
-
outputs=input_text,
|
| 2029 |
)
|
| 2030 |
|
| 2031 |
print("Gradio interface ready. Starting web server...")
|
|
|
|
| 1977 |
"(you can edit the text afterwards)."
|
| 1978 |
)
|
| 1979 |
|
| 1980 |
+
# 1) Complex input
|
| 1981 |
input_text = gr.Textbox(
|
| 1982 |
lines=12,
|
| 1983 |
label="Original text",
|
|
|
|
| 1985 |
elem_classes=["input-text"],
|
| 1986 |
)
|
| 1987 |
|
| 1988 |
+
# 2) Bridge button (directly under input)
|
| 1989 |
+
btn = gr.Button("Process & Simplify", variant="primary")
|
| 1990 |
+
|
| 1991 |
+
# 3) Simple output
|
| 1992 |
output_text = gr.Textbox(
|
| 1993 |
lines=12,
|
| 1994 |
label="Simplified text",
|
| 1995 |
elem_classes=["output-text"],
|
| 1996 |
)
|
| 1997 |
|
|
|
|
|
|
|
| 1998 |
btn.click(fn=process_text, inputs=input_text, outputs=output_text)
|
| 1999 |
|
| 2000 |
+
# Examples / clear (under the whole stack, or under input if you prefer)
|
| 2001 |
EXAMPLE_SENTENCES = [
|
| 2002 |
"John kicked the ball and walked to Leeds.",
|
| 2003 |
"John is one test, Mary, who lives in London, loves exams, and Bill eats bread.",
|
|
|
|
| 2025 |
ex_btn = gr.Button(label, size="sm")
|
| 2026 |
ex_btn.click(
|
| 2027 |
fn=lambda current, s=ex: append_example(current, s),
|
| 2028 |
+
inputs=input_text,
|
| 2029 |
+
outputs=input_text,
|
| 2030 |
)
|
| 2031 |
|
| 2032 |
print("Gradio interface ready. Starting web server...")
|