Megalino111 commited on
Commit
87c3468
·
1 Parent(s): 2e7ea5c

Rename app1.py to app.py

Browse files
Files changed (2) hide show
  1. app.py +25 -0
  2. app1.py +0 -15
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from huggingface_hub import HfApi
3
+ repo_id = "stabilityai/stable-diffusion-xl-base-0.9"
4
+ hf_token="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"
5
+
6
+ #token = gr.Textbox(label="token hugging face", placeholder="hg_...")
7
+ target_space_name = "SDXL"
8
+
9
+
10
+ from huggingface_hub import (
11
+ create_repo,
12
+ get_full_repo_name,
13
+ upload_file,
14
+ )
15
+ create_repo(name=target_space_name, token=hf_token, repo_type="space", space_sdk="gradio")
16
+ repo_name = get_full_repo_name(model_id=target_space_name, token=hf_token)
17
+ file_url = upload_file(
18
+ path_or_fileobj="file.txt",
19
+ path_in_repo="app.py",
20
+ repo_id=repo_name,
21
+ repo_type="space",
22
+ token=hf_token,
23
+ )
24
+
25
+ gr.Interface.load("stabilityai/stable-diffusion-xl-base-0.9", src="models").launch()
app1.py DELETED
@@ -1,15 +0,0 @@
1
- import gradio as gr
2
- from huggingface_hub import HfApi
3
- repo_id = "stabilityai/stable-diffusion-xl-base-0.9"
4
- hf_api = HfApi(
5
- endpoint="https://huggingface.co/api/models/stabilityai/stable-diffusion-xl-base-0.9", # Can be a Private Hub endpoint.
6
- token="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", # Token is not persisted on the machine.
7
- )
8
-
9
- token = gr.Textbox(label="token hugging face", placeholder="hg_...")
10
-
11
-
12
- api.create_repo(repo_id=repo_id, repo_type="space", space_sdk="gradio")
13
-
14
-
15
- gr.Interface.load("stabilityai/stable-diffusion-xl-base-0.9", src="models").launch()