m3g4p0p commited on
Commit
4e87ee2
·
1 Parent(s): 2566562

add static path

Browse files
myapp/app.py CHANGED
@@ -1,6 +1,7 @@
1
  import re
2
  from functools import partial
3
  from io import BytesIO
 
4
  from typing import Any, cast
5
 
6
  import gradio as gr
@@ -21,6 +22,7 @@ except ImportError:
21
  pass
22
 
23
  client = InferenceClient(model="black-forest-labs/FLUX.1-schnell")
 
24
 
25
  MODELS = [
26
  "stabilityai/stable-diffusion-3.5-large",
@@ -39,7 +41,9 @@ with gr.Blocks() as demo:
39
 
40
  with gr.Column():
41
  output = gr.Image()
42
- background = gr.Image("example.webp", visible=False, type="filepath")
 
 
43
  scale = gr.Slider(3, 15, 9, step=1, label="Scale")
44
 
45
  with gr.Row():
 
1
  import re
2
  from functools import partial
3
  from io import BytesIO
4
+ from pathlib import Path
5
  from typing import Any, cast
6
 
7
  import gradio as gr
 
22
  pass
23
 
24
  client = InferenceClient(model="black-forest-labs/FLUX.1-schnell")
25
+ static_path = Path(__file__).parent.relative_to(Path.cwd()) / "static"
26
 
27
  MODELS = [
28
  "stabilityai/stable-diffusion-3.5-large",
 
41
 
42
  with gr.Column():
43
  output = gr.Image()
44
+ background = gr.Image(
45
+ str(static_path / "example.webp"), visible=False, type="filepath"
46
+ )
47
  scale = gr.Slider(3, 15, 9, step=1, label="Scale")
48
 
49
  with gr.Row():
myapp/pall_app.py CHANGED
@@ -7,7 +7,7 @@ from myapp.colorutils import array_to_hex
7
  from myapp.palette import extract_color_clusters, iter_color_shades
8
 
9
  with gr.Blocks() as demo:
10
- image = gr.Image("vulture.webp")
11
  n_colors = gr.Slider(1, 16, 4, step=1)
12
  button = gr.Button()
13
 
 
7
  from myapp.palette import extract_color_clusters, iter_color_shades
8
 
9
  with gr.Blocks() as demo:
10
+ image = gr.Image("static/vulture.webp")
11
  n_colors = gr.Slider(1, 16, 4, step=1)
12
  button = gr.Button()
13
 
myapp/{example.webp → static/example.webp} RENAMED
File without changes
myapp/{vulture.webp → static/vulture.webp} RENAMED
File without changes
pyproject.toml CHANGED
@@ -13,7 +13,10 @@ dependencies = [
13
  ]
14
 
15
  [project.optional-dependencies]
16
- develop = ["ipdb>=0.13.13", "python-dotenv>=1.0.1"]
 
 
 
17
 
18
  [tool.setuptools.packages.find]
19
  include = ["myapp"]
 
13
  ]
14
 
15
  [project.optional-dependencies]
16
+ develop = [
17
+ "ipdb>=0.13.13",
18
+ "python-dotenv>=1.0.1",
19
+ ]
20
 
21
  [tool.setuptools.packages.find]
22
  include = ["myapp"]