Skip to content

Instantly share code, notes, and snippets.

Hamlet Batista hamletbatista

Block or report user

Report or block hamletbatista

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View uncompress_and_move_models.sh
!unzip /content/PreSumm/models/bertext_cnndm_transformer.zip
!unzip /content/PreSumm/models/bertsumextabs_cnndm_final_model.zip
!unzip /content/PreSumm/models/bertsumextabs_xsum_final_model.zip
!mkdir /content/PreSumm/models/CNN_DailyMail_Extractive
!mkdir /content/PreSumm/models/CNN_DailyMail_Abstractive
!mkdir /content/PreSumm/models/XSUM_OneSentence
!mv /content/PreSumm/models/bertext_cnndm_transformer.pt /content/PreSumm/models/CNN_DailyMail_Extractive
!mv /content/PreSumm/models/model_step_148000.pt /content/PreSumm/models/CNN_DailyMail_Abstractive
View download_presum_dependencies.sh
%cd /content/PreSumm/models
#CNN/DM Extractive bertext_cnndm_transformer.pt
!gdown https://drive.google.com/uc?id=1kKWoV0QCbeIuFt85beQgJ4v0lujaXobJ&export=download
#CNN/DM Abstractive model_step_148000.pt
!gdown https://drive.google.com/uc?id=1-IKVCtc4Q-BdZpjXc4s70_fRsWnjtYLr&export=download
#XSUM (One Sentence Summary) model_step_30000.pt
!gdown https://drive.google.com/uc?id=1H50fClyTkNprWJNh10HWdGEdDdQIkzsI&export=download
View summarizer.patch
--- /content/PreSumm/src/summarizer.py 2019-10-29 02:12:01.951535276 +0000
+++ /content/PreSumm/src/summarizer2.py 2019-10-29 03:47:19.168619951 +0000
@@ -1,6 +1,6 @@
#!/usr/bin/env python
"""
- Inference entrance
+ Main training workflow
"""
from __future__ import division
View create_file_colab.py
#For example, let's create a YAML file to feed Ludwig
contents="""
input_features:
-
name: text
type: text
level: word
encoder: parallel_cnn
output_features:
View ranksense-tags.json
[
{
"id": 26,
"name": "Account Pages",
"type": "AFFECTED"
},
{
"id": 55,
"name": "Add Correct Canonicals",
"type": "SOLUTION"
View visualize_final_reframe.py
data = []
ages = ["Pre-K", "Grade School", "Teens", "Young Adults", "Over 30", "Seniors"]
top_5 = []
for i in range(5):
scores = []
for age in ages:
scores.append(tuple(rides.sort_values(age, ascending=False)[[age, "Ride"]].iloc[i].values))
top_5.append(scores)
View get_disney_ride_ratings.py
# Get Disney Attractiveness Ratings
import requests
from bs4 import BeautifulSoup
r = requests.get("https://touringplans.com/disneyland/attractions")
soup = BeautifulSoup(r.text)
rows = []
table = soup.find("table")
for idx, tr in enumerate(table.findAll("tr")):
View enjoyment_score.py
# Data taken from here: https://touringplans.com/disneyland/attractions
# Ties in attraction ratings were resolved by selecting the age group closest to the next-highest score
df['Age Group'] = ["Pre-K", "Grade School", "Seniors",
"Pre-K", "Seniors", "Seniors",
"Pre-K", "Grade School", "Over 30",
"Seniors", "Pre-K", "Pre-K",
"Teens", "Teens", "Seniors",
"Young Adults", "Young Adults", "Teens",
"Pre-K", "Pre-K"]
View visualize_ridetimes.py
#!pip install plotly-express
import pandas as pd
from urllib.parse import urlparse
from collections import Counter
import plotly.express as px
import plotly
import plotly.graph_objects as go
fig = px.scatter(df, x="Average Wait Time", y="Ride Duration", color="Ride", symbol="Ride", height=900, width=1200)
View avgwaittimeandduration.py
average_wait=pd.Series(df.mean(), name="Average Wait Time")
print(average_wait)
#example output
#Astro Orbitor 12.453125
#Buzz Lightyear Astro Blasters 17.953125
duration = pd.Series(ride_durations, name="Ride Duration")
print(duration)
You can’t perform that action at this time.