Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -54,6 +54,13 @@ def encoder_decoder(text):
|
|
54 |
#text ="""
|
55 |
#Kathmandu, Nepal's capital, is set in a valley surrounded by the Himalayan mountains. At the heart of the old cityโs mazelike alleys is Durbar Square, which becomes frenetic during Indra Jatra, a religious festival featuring masked dances. Many of the city's historic sites were damaged or destroyed by a 2015 earthquake. Durbar Square's palace, Hanuman Dhoka, and Kasthamandap, a wooden Hindu temple, are being rebuilt. Kathmandu and adjacent cities are composed of neighbourhoods, which are utilized quite extensively and more familiar among locals. However, administratively the city is divided into 32 wards, numbered from 1 to 32. Earlier, there were 35 wards which made it the metropolitan city with the largest number of the wards. Balendra Shah (Balen) has been elected as the new mayor of Kathmandu.Kathmandu Municipal Corporation (KMC) is the chief nodal agency for the administration of Kathmandu. The Municipality of Kathmandu was upgraded to a metropolitan city in 1995.Kathmandu's urban cosmopolitan character has made it the most populous city in Nepal.Metropolitan Kathmandu is divided into five sectors: the Central Sector, the East Sector, the North Sector, the City Core and the West Sector. For civic administration, the city is further divided into 35 administrative wards. The Council administers the Metropolitan area of Kathmandu city through its 177 elected representatives and 20 nominated members. It holds biannual meetings to review, process and approve the annual budget and make major policy decisions.he ancient trade route between India and Tibet that passed through Kathmandu enabled a fusion of artistic and architectural traditions from other cultures to be amalgamated with local art and architecture.The monuments of Kathmandu City have been influenced over the centuries by Hindu and Buddhist religious practices. The architectural treasure of the Kathmandu valley has been categorized under the well-known seven groups of heritage monuments and buildings. In 2006 UNESCO declared these seven groups of monuments as a World Heritage Site (WHS). The seven monuments zones cover an area of 189 hectares (470 acres), with the buffer zone extending to 2,394 hectares (5,920 acres). The Seven Monument Zones inscribed originally in 1979 and with a minor modification in 2006 are the Durbar squares of Hanuman Dhoka, Patan and Bhaktapur, the Hindu temples of Pashupatinath and Changunarayan, the Buddhist stupas of Swayambhunath and Boudhanath.
|
56 |
#"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
#Title
|
59 |
|
@@ -67,12 +74,14 @@ st.write("Click on the button to summarize your text.")
|
|
67 |
button = st.button("Summarize")
|
68 |
st.divider()
|
69 |
st.info("Please note that this is a beta version and summarized content may not be accurate. To get an accurate content the models need to be fined tuned and trained on respective context which requires GPUS. Please feel free to share your feedback with us.")
|
|
|
70 |
if button:
|
71 |
if text:
|
72 |
if model == "Transformer":
|
73 |
st.write("You have selected Transformer model.")
|
74 |
try:
|
75 |
summary = transform_summarize(text)
|
|
|
76 |
except Exception:
|
77 |
st.warning("๐จ Your input text is quite lengthy. For better results, consider providing a shorter text or breaking it into smaller chunks.")
|
78 |
elif model == "T5":
|
@@ -85,12 +94,14 @@ if button:
|
|
85 |
st.write("You have selected BART model.")
|
86 |
try:
|
87 |
summary = bart_summarize(text)
|
|
|
88 |
except Exception:
|
89 |
st.warning("๐จ Your input text is quite lengthy. For better results, consider providing a shorter text or breaking it into smaller chunks.")
|
90 |
elif model == "Encoder-Decoder":
|
91 |
st.write("You have selected Encoder-Decoder model.")
|
92 |
try:
|
93 |
summary = encoder_decoder(text)
|
|
|
94 |
except Exception:
|
95 |
st.warning("๐จ Your input text is quite lengthy. For better results, consider providing a shorter text or breaking it into smaller chunks.")
|
96 |
|
@@ -98,9 +109,9 @@ if button:
|
|
98 |
#with st.spinner("Summarizing..."):
|
99 |
# time.sleep(5)
|
100 |
# st.toast("Done!!",icon="๐")
|
101 |
-
st.success('Please wait while we process and summarize')
|
102 |
-
time.sleep(15)
|
103 |
-
st.subheader(":violet[Your summarized text is:]")
|
104 |
-
st.write(summary)
|
105 |
else:
|
106 |
st.warning("Please enter the text !!")
|
|
|
54 |
#text ="""
|
55 |
#Kathmandu, Nepal's capital, is set in a valley surrounded by the Himalayan mountains. At the heart of the old cityโs mazelike alleys is Durbar Square, which becomes frenetic during Indra Jatra, a religious festival featuring masked dances. Many of the city's historic sites were damaged or destroyed by a 2015 earthquake. Durbar Square's palace, Hanuman Dhoka, and Kasthamandap, a wooden Hindu temple, are being rebuilt. Kathmandu and adjacent cities are composed of neighbourhoods, which are utilized quite extensively and more familiar among locals. However, administratively the city is divided into 32 wards, numbered from 1 to 32. Earlier, there were 35 wards which made it the metropolitan city with the largest number of the wards. Balendra Shah (Balen) has been elected as the new mayor of Kathmandu.Kathmandu Municipal Corporation (KMC) is the chief nodal agency for the administration of Kathmandu. The Municipality of Kathmandu was upgraded to a metropolitan city in 1995.Kathmandu's urban cosmopolitan character has made it the most populous city in Nepal.Metropolitan Kathmandu is divided into five sectors: the Central Sector, the East Sector, the North Sector, the City Core and the West Sector. For civic administration, the city is further divided into 35 administrative wards. The Council administers the Metropolitan area of Kathmandu city through its 177 elected representatives and 20 nominated members. It holds biannual meetings to review, process and approve the annual budget and make major policy decisions.he ancient trade route between India and Tibet that passed through Kathmandu enabled a fusion of artistic and architectural traditions from other cultures to be amalgamated with local art and architecture.The monuments of Kathmandu City have been influenced over the centuries by Hindu and Buddhist religious practices. The architectural treasure of the Kathmandu valley has been categorized under the well-known seven groups of heritage monuments and buildings. In 2006 UNESCO declared these seven groups of monuments as a World Heritage Site (WHS). The seven monuments zones cover an area of 189 hectares (470 acres), with the buffer zone extending to 2,394 hectares (5,920 acres). The Seven Monument Zones inscribed originally in 1979 and with a minor modification in 2006 are the Durbar squares of Hanuman Dhoka, Patan and Bhaktapur, the Hindu temples of Pashupatinath and Changunarayan, the Buddhist stupas of Swayambhunath and Boudhanath.
|
56 |
#"""
|
57 |
+
|
58 |
+
# Result
|
59 |
+
def result(summary):
|
60 |
+
st.success('Please wait while we process and summarize')
|
61 |
+
time.sleep(12)
|
62 |
+
st.subheader(":violet[Your summarized text is:]")
|
63 |
+
st.write(summary)
|
64 |
|
65 |
#Title
|
66 |
|
|
|
74 |
button = st.button("Summarize")
|
75 |
st.divider()
|
76 |
st.info("Please note that this is a beta version and summarized content may not be accurate. To get an accurate content the models need to be fined tuned and trained on respective context which requires GPUS. Please feel free to share your feedback with us.")
|
77 |
+
st.divider()
|
78 |
if button:
|
79 |
if text:
|
80 |
if model == "Transformer":
|
81 |
st.write("You have selected Transformer model.")
|
82 |
try:
|
83 |
summary = transform_summarize(text)
|
84 |
+
result(summary)
|
85 |
except Exception:
|
86 |
st.warning("๐จ Your input text is quite lengthy. For better results, consider providing a shorter text or breaking it into smaller chunks.")
|
87 |
elif model == "T5":
|
|
|
94 |
st.write("You have selected BART model.")
|
95 |
try:
|
96 |
summary = bart_summarize(text)
|
97 |
+
result(summary)
|
98 |
except Exception:
|
99 |
st.warning("๐จ Your input text is quite lengthy. For better results, consider providing a shorter text or breaking it into smaller chunks.")
|
100 |
elif model == "Encoder-Decoder":
|
101 |
st.write("You have selected Encoder-Decoder model.")
|
102 |
try:
|
103 |
summary = encoder_decoder(text)
|
104 |
+
result(summary)
|
105 |
except Exception:
|
106 |
st.warning("๐จ Your input text is quite lengthy. For better results, consider providing a shorter text or breaking it into smaller chunks.")
|
107 |
|
|
|
109 |
#with st.spinner("Summarizing..."):
|
110 |
# time.sleep(5)
|
111 |
# st.toast("Done!!",icon="๐")
|
112 |
+
# st.success('Please wait while we process and summarize')
|
113 |
+
# time.sleep(15)
|
114 |
+
# st.subheader(":violet[Your summarized text is:]")
|
115 |
+
# st.write(summary)
|
116 |
else:
|
117 |
st.warning("Please enter the text !!")
|