Skip to content

Commit

Permalink
fixes to frontend ex
Browse files Browse the repository at this point in the history
  • Loading branch information
SkafteNicki committed Jan 17, 2025
1 parent 765e290 commit f6e6922
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
6 changes: 3 additions & 3 deletions s7_deployment/frontend.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ which can be found in the `samples/frontend_backend` folder.

3. Have a button that sends the image to the backend and displays the result

For now just assume that a environment variable called `BACKEND` is available that contains the URL of the
For now just assume that an environment variable called `BACKEND` is available that contains the URL of the
backend. We will in the next step show how to get this URL automatically.

??? success "Solution"
Expand Down Expand Up @@ -229,10 +229,10 @@ which can be found in the `samples/frontend_backend` folder.
8. Run the frontend image

```bash
docker run --rm -p 8001:8001 -e "PORT=8001" backend
docker run --rm -p 8001:8001 -e "PORT=8001" frontend
```

and check in your web browser that the frontend works as expected.
And check in your web browser that the frontend works as expected.

9. Deploy the frontend to Cloud run using the `gcloud` command

Expand Down
2 changes: 1 addition & 1 deletion samples/frontend_backend/frontend.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements_front

EXPOSE $PORT

CMD ["streamlit", "run", "frontend.py", "--server.port", "$PORT"]
ENTRYPOINT ["streamlit", "run", "frontend.py", "--server.port", "$PORT", "--server.address=0.0.0.0"]
15 changes: 11 additions & 4 deletions tools/repo_stats/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,25 @@ def main():

merged_prs = [p["number"] for p in prs if p["merged_at"] is not None]
for pr_num in merged_prs:
pr_commits = requests.get(
pr_commits: list[dict] = requests.get(
f"{group.repo_api}/pulls/{pr_num}/commits", headers=headers, timeout=100
).json()
commit_messages += [c["commit"]["message"] for c in pr_commits]
for commit in pr_commits:
for contributor in contributors:
commit_author = commit.get("author") # GitHub account info
commit_committer = commit.get("committer") # GitHub account info
commit_author_name = commit["commit"]["author"]["name"]
commit_committer_name = commit["commit"]["committer"]["name"]

if (
commit["committer"] is not None
and "login" in commit["committer"]
and contributor.login == commit["author"]["login"]
(commit_author and commit_author["login"] == contributor.login)
or (commit_author_name == contributor.login)
or (commit_committer and commit_committer["login"] == contributor.login)
or (commit_committer_name == contributor.login)
):
contributor.commits_pr += 1
break
commits += pr_commits

activity_matrix = create_activity_matrix(commits, max_delta=3, min_delta=1)
Expand Down

0 comments on commit f6e6922

Please sign in to comment.