Skip to content

Commit

Permalink
Fix the Playground to ignore comments in the requirements text (#10073)
Browse files Browse the repository at this point in the history
* Fix the Playground to ignore comments in the requirements text

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
  • Loading branch information
whitphx and gradio-pr-bot authored Nov 30, 2024
1 parent bf03d54 commit 873dab5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/beige-ties-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"website": minor
---

feat:Fix the Playground to ignore comments in the requirements text
5 changes: 4 additions & 1 deletion js/_website/src/lib/components/DemosLite.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,10 @@ You only return the content of \`requirements.txt\`, without any other texts or
}
function cleanupRequirements(requirements: string[]): string[] {
return requirements.filter((r) => r.trim() !== "");
return requirements
.map((r) => r.split("#")[0]) // Remove comments
.map((r) => r.trim())
.filter((r) => r !== "");
}
onMount(async () => {
Expand Down

0 comments on commit 873dab5

Please sign in to comment.