Spaces:
Runtime error
Runtime error
UI
Browse files- app.py +19 -14
- open_pr.py +1 -1
app.py
CHANGED
|
@@ -7,6 +7,8 @@ from open_pr import open_pr
|
|
| 7 |
|
| 8 |
enable_space_ci()
|
| 9 |
|
|
|
|
|
|
|
| 10 |
DESCRIPTION = """
|
| 11 |
## Gradio Space CI is a tool to create ephemeral Spaces for each PR opened on your Space repo.
|
| 12 |
|
|
@@ -26,17 +28,20 @@ For more details about **Gradio Space CI**, checkout [this page]](https://huggin
|
|
| 26 |
If you find any issues, please report here: https://huggingface.co/spaces/Wauplin/gradio-space-ci/discussions
|
| 27 |
"""
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
)
|
| 39 |
-
|
| 40 |
-
with gr.
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
enable_space_ci()
|
| 9 |
|
| 10 |
+
TITLE = "Listen to Pull Requests and start ephemeral Spaces on new PRs! 🚀"
|
| 11 |
+
|
| 12 |
DESCRIPTION = """
|
| 13 |
## Gradio Space CI is a tool to create ephemeral Spaces for each PR opened on your Space repo.
|
| 14 |
|
|
|
|
| 28 |
If you find any issues, please report here: https://huggingface.co/spaces/Wauplin/gradio-space-ci/discussions
|
| 29 |
"""
|
| 30 |
|
| 31 |
+
with gr.Blocks() as blocks:
|
| 32 |
+
gr.Markdown(f"<h1 style='text-align: center; margin-bottom: 1rem'>{TITLE}</h1>")
|
| 33 |
+
gr.Markdown(DESCRIPTION)
|
| 34 |
+
|
| 35 |
+
with gr.Row(equal_height=False):
|
| 36 |
+
with gr.Column():
|
| 37 |
+
space_id = gr.Textbox(label="Space ID or URL", lines=1)
|
| 38 |
+
gr.LoginButton()
|
| 39 |
+
gr.LogoutButton()
|
| 40 |
+
submit_btn = gr.Button("Submit", variant="primary")
|
| 41 |
+
|
| 42 |
+
with gr.Column():
|
| 43 |
+
output = gr.Markdown()
|
| 44 |
+
|
| 45 |
+
submit_btn.click(open_pr, space_id, output)
|
| 46 |
+
|
| 47 |
+
blocks.launch()
|
open_pr.py
CHANGED
|
@@ -42,7 +42,7 @@ You can contact the Space owner to let them know about this PR.
|
|
| 42 |
"""
|
| 43 |
|
| 44 |
|
| 45 |
-
def open_pr(space_id_or_url: str,
|
| 46 |
if oauth_token is None:
|
| 47 |
raise gr.Error("You must be logged in to open a PR. Click on 'Sign in with Huggingface' first.")
|
| 48 |
token = oauth_token.token
|
|
|
|
| 42 |
"""
|
| 43 |
|
| 44 |
|
| 45 |
+
def open_pr(space_id_or_url: str, oauth_token: gr.OAuthToken | None) -> str:
|
| 46 |
if oauth_token is None:
|
| 47 |
raise gr.Error("You must be logged in to open a PR. Click on 'Sign in with Huggingface' first.")
|
| 48 |
token = oauth_token.token
|