Skip to content

Commit 00e82a6

Browse files
committed
Merge branch 'master' of https://github.com/pksX01/keras-io into vit_small
2 parents 9c0becb + ad92857 commit 00e82a6

File tree

236 files changed

+32509
-5240
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

236 files changed

+32509
-5240
lines changed

.github/workflows/continuous_integration.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Continuous integration
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
47

58
jobs:
69
black:

.github/workflows/csat.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: 'CSAT survey'
2+
on:
3+
issues:
4+
types:
5+
- closed
6+
7+
permissions:
8+
contents: read
9+
issues: write
10+
pull-requests: write
11+
12+
jobs:
13+
welcome:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: actions/github-script@v6
18+
with:
19+
script: |
20+
const script = require('./\.github/workflows/scripts/csat.js')
21+
script({github, context})

.github/workflows/scripts/constant.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
let CONSTANT_VALUES = {
2+
MODULE: {
3+
CSAT: {
4+
YES:'Yes',
5+
NO:'No',
6+
BASE_URL: 'https://docs.google.com/forms/d/e/1FAIpQLSdHag0RVFS7UXzZkKcsFCKOcX8raCupKK9RHSlYxp5U8lSJbQ/viewform?',
7+
SATISFACTION_PARAM: 'entry.492125872=',
8+
ISSUEID_PARAM: '&entry.243948740=',
9+
MSG: 'Are you satisfied with the resolution of your issue?',
10+
CSAT_LABELS: ['type:bug', 'type:build/install', 'type:support', 'type:others', 'type:docs-bug', 'type:performance', 'type:feature']
11+
}
12+
}
13+
};
14+
module.exports = CONSTANT_VALUES;

.github/workflows/scripts/csat.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
const CONSTANT_VALUES = require('./constant');
3+
/**
4+
* Invoked from staleCSAT.js and CSAT.yaml file to
5+
* post survey link in closed issue.
6+
* @param {!object} Object - gitHub and context contains the information about the
7+
* current and context and github APIs using their built-in library functions.
8+
*/
9+
module.exports = async ({ github, context }) => {
10+
const issue = context.payload.issue.html_url;
11+
let base_url = CONSTANT_VALUES.MODULE.CSAT.BASE_URL;
12+
//Loop over all ths label present in issue and check if specific label is present for survey link.
13+
for (const label of context.payload.issue.labels) {
14+
if (CONSTANT_VALUES.MODULE.CSAT.CSAT_LABELS.includes(label.name)) {
15+
console.log(`label-${label.name}, posting CSAT survey for issue =${issue}`);
16+
const yesCsat = `<a href="${base_url + CONSTANT_VALUES.MODULE.CSAT.SATISFACTION_PARAM +
17+
CONSTANT_VALUES.MODULE.CSAT.YES +
18+
CONSTANT_VALUES.MODULE.CSAT.ISSUEID_PARAM + issue}"> ${CONSTANT_VALUES.MODULE.CSAT.YES}</a>`;
19+
20+
const noCsat = `<a href="${base_url + CONSTANT_VALUES.MODULE.CSAT.SATISFACTION_PARAM +
21+
CONSTANT_VALUES.MODULE.CSAT.NO +
22+
CONSTANT_VALUES.MODULE.CSAT.ISSUEID_PARAM + issue}"> ${CONSTANT_VALUES.MODULE.CSAT.NO}</a>`;
23+
const comment = CONSTANT_VALUES.MODULE.CSAT.MSG + '\n' + yesCsat + '\n' +
24+
noCsat + '\n';
25+
let issueNumber = context.issue.number ?? context.payload.issue.number;
26+
await github.rest.issues.createComment({
27+
issue_number: issueNumber,
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
body: comment
31+
});
32+
}
33+
}
34+
};
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
const csat = require('./csat.js');
3+
const CONSTANT = require("./constant.js");
4+
/**
5+
*When stale bot closes the issue this function will
6+
*invoke and post CSAT link on the issue.
7+
*This function will fetch all the issues closed within 10 minutes and
8+
*post the survey link if survey link is not posted already.
9+
* @param {!object} Object - gitHub and context contains the information about
10+
*the current and context and github APIs using their built-in library
11+
*functions.
12+
*/
13+
module.exports = async ({ github, context }) => {
14+
let date = new Date();
15+
let totalMilliSeconds = date.getTime();
16+
let minutes = 10;
17+
let millisecondsToSubtract = minutes * 60 * 1000;
18+
let closeTime = totalMilliSeconds-millisecondsToSubtract;
19+
let newDate = new Date(closeTime);
20+
let ISOCloseTime = newDate.toISOString();
21+
// Fetch all the issue closed with in 10 mins.
22+
let closeTimeIssues = await github.rest.issues.listForRepo({
23+
owner: context.repo.owner,
24+
repo: context.repo.repo,
25+
state:"closed",
26+
labels:"stale",
27+
since:ISOCloseTime
28+
});
29+
let ISSUESLIST = closeTimeIssues.data;
30+
console.log(`Fetching all the closed within ${minutes} minutes.`);
31+
console.log(ISSUESLIST);
32+
for(let i=0;i<ISSUESLIST.length;i++){
33+
if(ISSUESLIST[i].node_id && ISSUESLIST[i].node_id.indexOf("PR") !=-1)
34+
continue;
35+
// Fetch last comments for the issues.
36+
let comments = await github.rest.issues.listComments({
37+
owner: context.repo.owner,
38+
repo: context.repo.repo,
39+
issue_number: ISSUESLIST[i].number
40+
});
41+
let noOfComments = comments.data.length;
42+
let lastComment = comments.data[noOfComments-1];
43+
let strCom = JSON.stringify(lastComment);
44+
if(strCom.indexOf(CONSTANT.MODULE.CSAT.MSG) == -1){
45+
context.payload.issue = {};
46+
context.payload.issue.number = ISSUESLIST[i].number;
47+
context.payload.issue.labels = ISSUESLIST[i].labels;
48+
context.payload.issue.html_url = ISSUESLIST[i].html_url;
49+
csat({github, context});
50+
}
51+
}
52+
};

.github/workflows/stale-issues-pr.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,9 @@ jobs:
4848
close-issue-message: >
4949
This issue was closed because it has been inactive for more than 1 year.
5050
repo-token: ${{ secrets.GITHUB_TOKEN }}
51+
- uses: actions/checkout@v3
52+
- uses: actions/github-script@v6
53+
with:
54+
script: |
55+
const script = require('./\.github/workflows/scripts/stale_csat.js')
56+
script({github, context})

.github/workflows/upload.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Upload to S3
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
build:
9+
strategy:
10+
fail-fast: false
11+
runs-on: ubuntu-latest
12+
env:
13+
AWS_S3_ACCESS_KEY: ${{ secrets.AWS_S3_ACCESS_KEY }}
14+
AWS_S3_SECRET_KEY: ${{ secrets.AWS_S3_SECRET_KEY }}
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: "3.10"
21+
- name: Get pip cache dir
22+
id: pip-cache
23+
run: |
24+
python -m pip install --upgrade pip setuptools
25+
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
26+
- name: pip cache
27+
uses: actions/cache@v3
28+
with:
29+
path: ${{ steps.pip-cache.outputs.dir }}
30+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
31+
- name: Install dependencies
32+
run: |
33+
pip install -r requirements.txt --progress-bar off --upgrade
34+
pip install keras --upgrade
35+
- name: Build website
36+
run: |
37+
python scripts/autogen.py make
38+
- name: Upload files
39+
run: |
40+
python scripts/upload.py

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
tmp/*
22
sources/*
33
site/*
4-
scripts/upload.py
54
*.pyc
65
*.swp
76
templates/examples/generative/*

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ FROM python:3.9
22

33
COPY requirements.txt ./
44
RUN pip install -r requirements.txt
5+
RUN pip install keras==3.0.4
56

67
COPY ./ ./
78
WORKDIR scripts
89
RUN python autogen.py make
910

10-
CMD ["python", "-u", "autogen.py", "serve"]
11+
CMD ["python", "-u", "autogen.py", "serve"]

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ This repository hosts the code used to generate the [keras.io](https://keras.io)
66

77
```
88
pip install -r requirements.txt
9+
# Update Keras version to 3
10+
pip install keras==3.0.2
911
cd scripts
1012
python autogen.py make
1113
python autogen.py serve

0 commit comments

Comments
 (0)