Bayhaqy commited on
Commit
d4179ef
1 Parent(s): ae10a2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -16
app.py CHANGED
@@ -53,20 +53,30 @@ if fetch_button:
53
 
54
  with st.spinner('Fetching your article...'):
55
  time.sleep(3)
56
- st.success('Your article is ready for summarization!')
57
-
58
- article = Article(url)
59
- article.download()
60
- article.parse()
61
-
62
- title = article.title
63
- text = article.text
64
 
65
- st.divider()
66
- st.subheader("Real Article")
67
- st.markdown(f"Your article: **{title}**")
68
- st.markdown(f"**{text}**")
69
- st.divider()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  else:
72
  st.write("Error occurred while fetching article.")
@@ -74,7 +84,6 @@ if fetch_button:
74
  except Exception as e:
75
  st.write(f"Error occurred while fetching article: {e}")
76
 
77
-
78
  # HuggingFace API KEY input
79
  API_KEY = st.text_input("Enter your HuggingFace API key", type="password")
80
 
@@ -93,7 +102,7 @@ else:
93
 
94
  API_URL_TL = "https://api-inference.huggingface.co/models/facebook/mbart-large-50-many-to-many-mmt"
95
 
96
- submit_button = st.button("Submit")
97
 
98
  # Download and parse the article
99
  if submit_button:
@@ -103,6 +112,7 @@ if submit_button:
103
 
104
  title = article.title
105
  text = article.text
 
106
 
107
  # HuggingFace API request function summary
108
  def query_sum(payload):
@@ -127,4 +137,16 @@ if submit_button:
127
  st.subheader("Real Article")
128
  st.markdown(f"Your article: **{title}**")
129
  st.markdown(f"**{text}**")
130
- st.divider()
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
  with st.spinner('Fetching your article...'):
55
  time.sleep(3)
56
+ st.success('Your article is ready for summarization!')
57
+
58
+ view_button = st.button("View Article")
 
 
 
 
 
59
 
60
+ if view_button:
61
+ article = Article(url)
62
+ article.download()
63
+ article.parse()
64
+
65
+ title = article.title
66
+ text = article.text
67
+ html = article.html
68
+
69
+ st.divider()
70
+ st.subheader("Real Article")
71
+ st.markdown(f"Your article: **{title}**")
72
+ st.markdown(f"**{text}**")
73
+ st.divider()
74
+
75
+ st.divider()
76
+ st.subheader("Real Article (HTML)")
77
+ st.markdown(f"Your article: **{title}**")
78
+ st.markdown(f"**{html}**")
79
+ st.divider()
80
 
81
  else:
82
  st.write("Error occurred while fetching article.")
 
84
  except Exception as e:
85
  st.write(f"Error occurred while fetching article: {e}")
86
 
 
87
  # HuggingFace API KEY input
88
  API_KEY = st.text_input("Enter your HuggingFace API key", type="password")
89
 
 
102
 
103
  API_URL_TL = "https://api-inference.huggingface.co/models/facebook/mbart-large-50-many-to-many-mmt"
104
 
105
+ submit_button = st.button("Submit to Summarize")
106
 
107
  # Download and parse the article
108
  if submit_button:
 
112
 
113
  title = article.title
114
  text = article.text
115
+ html = article.html
116
 
117
  # HuggingFace API request function summary
118
  def query_sum(payload):
 
137
  st.subheader("Real Article")
138
  st.markdown(f"Your article: **{title}**")
139
  st.markdown(f"**{text}**")
140
+ st.divider()
141
+
142
+ st.divider()
143
+ st.subheader("Real Article")
144
+ st.markdown(f"Your article: **{title}**")
145
+ st.markdown(f"**{text}**")
146
+ st.divider()
147
+
148
+ st.divider()
149
+ st.subheader("Real Article (HTML)")
150
+ st.markdown(f"Your article: **{title}**")
151
+ st.markdown(f"**{html}**")
152
+ st.divider()