Wauplin HF staff commited on
Commit
a422428
1 Parent(s): afc2013

switch to gradio 3.40.0

Browse files
Files changed (4) hide show
  1. Dockerfile +0 -21
  2. README.md +2 -2
  3. app2.py +0 -42
  4. requirements.txt +1 -2
Dockerfile DELETED
@@ -1,21 +0,0 @@
1
- FROM python:3.10
2
-
3
- # User
4
- RUN useradd -m -u 1000 user
5
- USER user
6
- ENV HOME=/home/user \
7
- PATH=/home/user/.local/bin:$PATH
8
- WORKDIR /home/user/app
9
-
10
- RUN pip install --no-cache-dir https://gradio-builds.s3.amazonaws.com/f4d696f71f3fc2f5fd8f9d5f5287cb1d27ef93d4/gradio-3.39.0-py3-none-any.whl
11
-
12
- COPY --link --chown=1000 ./ /home/user/app
13
- ENV PYTHONPATH=$HOME/app \
14
- PYTHONUNBUFFERED=1 \
15
- GRADIO_ALLOW_FLAGGING=never \
16
- GRADIO_NUM_PORTS=1 \
17
- GRADIO_SERVER_NAME=0.0.0.0 \
18
- GRADIO_THEME=huggingface \
19
- SYSTEM=spaces
20
-
21
- ENTRYPOINT ["python", "app.py"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README.md CHANGED
@@ -3,9 +3,9 @@ title: Gradio Oauth Test
3
  emoji: 🏆
4
  colorFrom: pink
5
  colorTo: pink
6
- sdk: docker
 
7
  hf_oauth: true
8
- app_port: 7860
9
  ---
10
 
11
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
3
  emoji: 🏆
4
  colorFrom: pink
5
  colorTo: pink
6
+ sdk: gradio
7
+ sdk_version: 3.40.0
8
  hf_oauth: true
 
9
  ---
10
 
11
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app2.py DELETED
@@ -1,42 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import gradio as gr
4
- import gradio.utils
5
-
6
-
7
- if gradio.utils.get_space() is not None:
8
- URL, PORT = "https://wauplin-gradio-oauth-test.hf.space", 7860
9
- else:
10
- URL, PORT = "http://localhost:5173", 5173
11
-
12
- TEMPLATE = """
13
- ### Name: {name}
14
- ### Username: {preferred_username}
15
- ### Profile: {profile}
16
- ### Website: {website}
17
-
18
- ![Profile Picture]({picture})
19
-
20
- You can manage your connected applications in your [settings](https://huggingface.co/settings/connected-applications).
21
- """
22
-
23
-
24
- def show_profile(profile: gr.OAuthProfile) -> str:
25
- # request.session in case of websockets (see `def get_request_params`)
26
- # request.request.session in case of direct call
27
- return TEMPLATE.format(**profile)
28
-
29
-
30
- with gr.Blocks() as demo:
31
- with gr.Row():
32
- gr.LoginButton()
33
- gr.LogoutButton()
34
-
35
- profile_btn = gr.Button("Show profile")
36
- output = gr.Markdown()
37
- profile_btn.click(fn=show_profile, outputs=output)
38
-
39
- print(URL)
40
-
41
- demo.queue()
42
- demo.launch(server_port=PORT)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt CHANGED
@@ -1,2 +1 @@
1
- authlib==1.2.1
2
- itsdangerous==2.1.2
 
1
+ gradio[oauth]