Wauplin HF staff commited on
Commit
b23c183
β€’
1 Parent(s): 5a798d0
Files changed (2) hide show
  1. app.py +19 -14
  2. 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
- interface = gr.Interface(
30
- fn=open_pr,
31
- inputs=["text", gr.LoginButton(), gr.LogoutButton()],
32
- outputs="markdown",
33
- title="Listen to Pull Requests and start ephemeral Spaces on new PRs! πŸš€",
34
- description=DESCRIPTION,
35
- article="Provide a space ID and a token and click 'Submit'. A PR will be open to Space CI on the provided Space. You don't have to be the Space owner to open the PR.",
36
- allow_flagging=False,
37
- allow_duplication=False,
38
- )
39
-
40
- with gr.Blocks() as demo:
41
- interface.render()
42
- demo.launch()
 
 
 
 
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, _1, _2, 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
 
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