inoculatemedia commited on
Commit
f23e2f9
·
verified ·
1 Parent(s): fdc7e66

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -43
app.py CHANGED
@@ -22,45 +22,6 @@ import random
22
  from huggingface_hub import hf_hub_download
23
 
24
  from src.gigachat import giga_generate
25
- from huggingface_hub import list_models
26
-
27
-
28
- def hello(profile: gr.OAuthProfile | None) -> str:
29
- # ^ expect a gr.OAuthProfile object as input to get the user's profile
30
- # if the user is not logged in, profile will be None
31
- if profile is None:
32
- return "I don't know you."
33
- return f"Hello {profile.name}"
34
-
35
-
36
- def list_private_models(profile: gr.OAuthProfile | None, oauth_token: gr.OAuthToken | None) -> str:
37
- # ^ expect a gr.OAuthToken object as input to get the user's token
38
- # if the user is not logged in, oauth_token will be None
39
- if oauth_token is None:
40
- return "Please log in to list private models."
41
- models = [
42
- f"{model.id} ({'private' if model.private else 'public'})"
43
- for model in list_models(author=profile.username, token=oauth_token.token)
44
- ]
45
- return "Models:\n\n" + "\n - ".join(models) + "."
46
-
47
-
48
- with gr.Blocks() as demo:
49
- gr.Markdown(
50
- "# Gradio OAuth Space"
51
- "\n\nThis Space is a demo for the **Sign in with HF中国镜像站** feature. "
52
- "Duplicate this Space to get started."
53
- "\n\nFor more details, check out:"
54
- "\n- https://www.gradio.app/guides/sharing-your-app#o-auth-login-via-hugging-face"
55
- "\n- https://huggingface.co/docs/hub/spaces-oauth"
56
- )
57
- gr.LoginButton()
58
- # ^ add a login button to the Space
59
- m1 = gr.Markdown()
60
- m2 = gr.Markdown()
61
- demo.load(hello, inputs=None, outputs=m1)
62
- demo.load(
63
-
64
 
65
  #gradio.helpers.CACHED_FOLDER = '/data/cache'
66
 
@@ -165,6 +126,7 @@ def resize_image(image, output_size=(672, 384)):
165
  with gr.Blocks() as demo:
166
  gr.Markdown('''# Text to Video using Kandinsky 4.0 T2V Flash
167
  <iframe src="https://www.haawke.com/js/index.html></iframe> "''')
 
168
  with gr.Row():
169
  with gr.Column():
170
  # image = gr.Image(label="Upload your image", type="pil")
@@ -260,7 +222,4 @@ with gr.Blocks() as demo:
260
 
261
  if __name__ == "__main__":
262
  #demo.queue(max_size=20, api_open=False)
263
- demo.launch(share=False, show_api=False))
264
- demo.launch()
265
-
266
-
 
22
  from huggingface_hub import hf_hub_download
23
 
24
  from src.gigachat import giga_generate
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  #gradio.helpers.CACHED_FOLDER = '/data/cache'
27
 
 
126
  with gr.Blocks() as demo:
127
  gr.Markdown('''# Text to Video using Kandinsky 4.0 T2V Flash
128
  <iframe src="https://www.haawke.com/js/index.html></iframe> "''')
129
+ gr.LoginButton()
130
  with gr.Row():
131
  with gr.Column():
132
  # image = gr.Image(label="Upload your image", type="pil")
 
222
 
223
  if __name__ == "__main__":
224
  #demo.queue(max_size=20, api_open=False)
225
+ demo.launch(share=False, show_api=False)