Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -1970,19 +1970,15 @@ custom_css = """
|
|
| 1970 |
}
|
| 1971 |
"""
|
| 1972 |
|
| 1973 |
-
with gr.Blocks(
|
| 1974 |
-
title="Syntactic Sentence Simplifier",
|
| 1975 |
-
css=custom_css,
|
| 1976 |
-
) as demo:
|
| 1977 |
gr.Markdown("# Syntactic Sentence Simplifier")
|
| 1978 |
-
gr.Markdown(
|
| 1979 |
-
"Paste or type your text below. Uses Hugging Face models + simplification logic."
|
| 1980 |
-
)
|
| 1981 |
|
|
|
|
| 1982 |
input_text = gr.Textbox(
|
| 1983 |
lines=10,
|
| 1984 |
label="Original text",
|
| 1985 |
-
placeholder="Paste your text here...",
|
| 1986 |
elem_classes=["input-text"],
|
| 1987 |
)
|
| 1988 |
|
|
@@ -1993,27 +1989,27 @@ with gr.Blocks(
|
|
| 1993 |
)
|
| 1994 |
|
| 1995 |
btn = gr.Button("Process & Simplify", variant="primary")
|
| 1996 |
-
|
| 1997 |
-
|
| 1998 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1999 |
inputs=input_text,
|
| 2000 |
-
|
| 2001 |
)
|
|
|
|
| 2002 |
|
| 2003 |
-
print("
|
| 2004 |
|
| 2005 |
if __name__ == "__main__":
|
| 2006 |
demo.launch(
|
| 2007 |
server_name="0.0.0.0",
|
| 2008 |
server_port=7860,
|
| 2009 |
-
css=custom_css, #
|
| 2010 |
-
)
|
| 2011 |
-
|
| 2012 |
-
|
| 2013 |
-
'''
|
| 2014 |
-
test = (
|
| 2015 |
-
"Joshua told me that John, who lives in London, is going to Wolverhampton, Jack loves Norwich, and Mary, who is a bit nervous, adores Birmingham, just as Fred predicted."
|
| 2016 |
)
|
| 2017 |
-
print(process_text(test))
|
| 2018 |
-
'''
|
| 2019 |
|
|
|
|
| 1970 |
}
|
| 1971 |
"""
|
| 1972 |
|
| 1973 |
+
with gr.Blocks(title="Syntactic Sentence Simplifier") as demo:
|
|
|
|
|
|
|
|
|
|
| 1974 |
gr.Markdown("# Syntactic Sentence Simplifier")
|
| 1975 |
+
gr.Markdown("Paste text or pick an example, then click Process & Simplify.")
|
|
|
|
|
|
|
| 1976 |
|
| 1977 |
+
# βββ THIS BLOCK GOES HERE βββ
|
| 1978 |
input_text = gr.Textbox(
|
| 1979 |
lines=10,
|
| 1980 |
label="Original text",
|
| 1981 |
+
placeholder="Paste your text here, or pick an example below...",
|
| 1982 |
elem_classes=["input-text"],
|
| 1983 |
)
|
| 1984 |
|
|
|
|
| 1989 |
)
|
| 1990 |
|
| 1991 |
btn = gr.Button("Process & Simplify", variant="primary")
|
| 1992 |
+
btn.click(fn=process_text, inputs=input_text, outputs=output_text)
|
| 1993 |
+
|
| 1994 |
+
gr.Examples(
|
| 1995 |
+
examples=[
|
| 1996 |
+
["John kicked the ball and walked to Leeds."],
|
| 1997 |
+
["John is one test, Mary, who lives in London, loves exams, and Bill eats bread."],
|
| 1998 |
+
["John went to Wolverhampton, Bill set out for Coventry, and Mary returned from Birmingham."],
|
| 1999 |
+
["John, who lives in London, is going to Wolverhampton, and Mary, who is a bit nervous, adores Birmingham."],
|
| 2000 |
+
["The Environment Agency said record winter rainfall had helped to replenish reservoirs and groundwater, but reservoir storage has now fallen to 7.4% below the average for this time of year."],
|
| 2001 |
+
],
|
| 2002 |
inputs=input_text,
|
| 2003 |
+
label="Try an example",
|
| 2004 |
)
|
| 2005 |
+
# βββ END OF UI βββ
|
| 2006 |
|
| 2007 |
+
print("Gradio interface ready. Starting web server...")
|
| 2008 |
|
| 2009 |
if __name__ == "__main__":
|
| 2010 |
demo.launch(
|
| 2011 |
server_name="0.0.0.0",
|
| 2012 |
server_port=7860,
|
| 2013 |
+
css=custom_css, # if you use custom_css
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2014 |
)
|
|
|
|
|
|
|
| 2015 |
|