xinah3131 commited on
Commit
b68bb4d
1 Parent(s): 2a10b7c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -7
app.py CHANGED
@@ -77,14 +77,23 @@ def main():
77
  width: 500px;
78
  height: 50px;
79
  }}
80
- .my-container {{
81
- border: 2px solid #d72324;
82
- padding: 10px;
 
 
 
 
83
  }}
84
  .stButton > button:hover {{
85
  background-color: white;
86
  color:#d72324;
87
  }}
 
 
 
 
 
88
 
89
  </style>
90
  """,
@@ -95,7 +104,9 @@ def main():
95
  #https://www.freepnglogos.com/uploads/youtube-play-red-logo-png-transparent-background-6.png
96
  # st.write("Enter the video details below:")
97
 
98
- # Define a boolean flag variable to track prediction status
 
 
99
 
100
  # Sidebar menu options
101
  menu_options = ["Predict", "Trending", "Visualize"]
@@ -167,6 +178,15 @@ def main():
167
  df = get_trending_videos(country_code)
168
  st.dataframe(df)
169
 
 
 
 
 
 
 
 
 
 
170
  with tab2:
171
  if df is not None:
172
  # Display video titles
@@ -221,9 +241,7 @@ def main():
221
  show_top_titleLength()
222
  with col13:
223
  show_best_titleLength()
224
-
225
-
226
-
227
  def get_picture_from_url(url):
228
  try:
229
  response = requests.get(url)
 
77
  width: 500px;
78
  height: 50px;
79
  }}
80
+ .stDownloadButton > button{{
81
+ background-color: #e7e7e7;
82
+ color:black;
83
+ font-weight: bold;
84
+ width: 150px;
85
+ height: 35px;
86
+ float: right;
87
  }}
88
  .stButton > button:hover {{
89
  background-color: white;
90
  color:#d72324;
91
  }}
92
+ .my-container {{
93
+ border: 2px solid #d72324;
94
+ padding: 10px;
95
+ }}
96
+
97
 
98
  </style>
99
  """,
 
104
  #https://www.freepnglogos.com/uploads/youtube-play-red-logo-png-transparent-background-6.png
105
  # st.write("Enter the video details below:")
106
 
107
+ @st.cache_data
108
+ def convert_df(df):
109
+ return df.to_csv(index=False).encode('utf-8')
110
 
111
  # Sidebar menu options
112
  menu_options = ["Predict", "Trending", "Visualize"]
 
178
  df = get_trending_videos(country_code)
179
  st.dataframe(df)
180
 
181
+ csv = convert_df(df)
182
+ st.download_button(
183
+ "Download",
184
+ csv,
185
+ "file.csv",
186
+ "text/csv",
187
+ key='download-csv'
188
+ )
189
+
190
  with tab2:
191
  if df is not None:
192
  # Display video titles
 
241
  show_top_titleLength()
242
  with col13:
243
  show_best_titleLength()
244
+
 
 
245
  def get_picture_from_url(url):
246
  try:
247
  response = requests.get(url)