Spaces:
Running
Running
remove dependency on spaces
Browse files- README.md +16 -0
- gradio_dualvision/app_template.py +0 -9
- requirements.txt +0 -1
README.md
CHANGED
@@ -49,6 +49,22 @@ Check out the template image processing [app.py](app.py); copy it and start modi
|
|
49 |
4. Implement `build_user_components` and `process` methods, and optionally `make_header`.
|
50 |
5. Launch the app!
|
51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
## Real talk
|
53 |
|
54 |
**Q: What is the idea behind this template?**<br>
|
|
|
49 |
4. Implement `build_user_components` and `process` methods, and optionally `make_header`.
|
50 |
5. Launch the app!
|
51 |
|
52 |
+
## DualVisionApp API
|
53 |
+
|
54 |
+
- `title`: Title of the application (str, required).
|
55 |
+
- `examples_path`: Base path where examples will be searched (Default: `"examples"`).
|
56 |
+
- `examples_per_page`: How many examples to show at the bottom of the app (Default: `5`).
|
57 |
+
- `examples_cache`: Examples caching policy, corresponding to `cache_examples` argument of gradio.Examples (Default: `"lazy"`).
|
58 |
+
- `squeeze_canvas`: When True, the image is fit to the browser viewport. When False, the image is fit to width (Default: `True`).
|
59 |
+
- `squeeze_viewport_height_pct`: Percentage of the browser viewport height (Default: `75`).
|
60 |
+
- `key_original_image`: Name of the key under which the input image is shown in the modality selectors (Default: `"Original"`).
|
61 |
+
- `slider_position`: Position of the slider between 0 and 1 (Default: `0.5`).
|
62 |
+
- `slider_line_color`: Color of the slider line (Default: `"#FFF"`).
|
63 |
+
- `slider_line_width`: Width of the slider line (Default: `"4px"`).
|
64 |
+
- `slider_arrows_color`: Color of the slider arrows (Default: `"#FFF"`).
|
65 |
+
- `slider_arrows_width`: Width of the slider arrows (Default: `2px`).
|
66 |
+
- `**kwargs`: Any other arguments that Gradio Blocks class can take.
|
67 |
+
|
68 |
## Real talk
|
69 |
|
70 |
**Q: What is the idea behind this template?**<br>
|
gradio_dualvision/app_template.py
CHANGED
@@ -37,7 +37,6 @@ import os
|
|
37 |
import re
|
38 |
|
39 |
import gradio as gr
|
40 |
-
import spaces
|
41 |
from PIL import Image
|
42 |
from gradio.components.base import Component
|
43 |
|
@@ -56,8 +55,6 @@ class DualVisionApp(gr.Blocks):
|
|
56 |
squeeze_canvas=True,
|
57 |
squeeze_viewport_height_pct=75,
|
58 |
key_original_image="Original",
|
59 |
-
spaces_zero_gpu_enabled=False,
|
60 |
-
spaces_zero_gpu_duration=None,
|
61 |
slider_position=0.5,
|
62 |
slider_line_color="#FFF",
|
63 |
slider_line_width="4px",
|
@@ -77,8 +74,6 @@ class DualVisionApp(gr.Blocks):
|
|
77 |
squeeze_canvas: When True, the image is fit to the browser viewport. When False, the image is fit to width (Default: `True`).
|
78 |
squeeze_viewport_height_pct: Percentage of the browser viewport height (Default: `75`).
|
79 |
key_original_image: Name of the key under which the input image is shown in the modality selectors (Default: `"Original"`).
|
80 |
-
spaces_zero_gpu_enabled: When True, the app wraps the processing function with the ZeroGPU decorator.
|
81 |
-
spaces_zero_gpu_duration: Defines an integer duration in seconds passed into the ZeroGPU decorator.
|
82 |
slider_position: Position of the slider between 0 and 1 (Default: `0.5`).
|
83 |
slider_line_color: Color of the slider line (Default: `"#FFF"`).
|
84 |
slider_line_width: Width of the slider line (Default: `"4px"`).
|
@@ -103,10 +98,6 @@ class DualVisionApp(gr.Blocks):
|
|
103 |
self.key_original_image = key_original_image
|
104 |
self.slider_position = slider_position
|
105 |
self.input_keys = None
|
106 |
-
if spaces_zero_gpu_enabled:
|
107 |
-
self.process_components = spaces.GPU(
|
108 |
-
self.process_components, duration=spaces_zero_gpu_duration
|
109 |
-
)
|
110 |
self.head = ""
|
111 |
self.head += """
|
112 |
<script>
|
|
|
37 |
import re
|
38 |
|
39 |
import gradio as gr
|
|
|
40 |
from PIL import Image
|
41 |
from gradio.components.base import Component
|
42 |
|
|
|
55 |
squeeze_canvas=True,
|
56 |
squeeze_viewport_height_pct=75,
|
57 |
key_original_image="Original",
|
|
|
|
|
58 |
slider_position=0.5,
|
59 |
slider_line_color="#FFF",
|
60 |
slider_line_width="4px",
|
|
|
74 |
squeeze_canvas: When True, the image is fit to the browser viewport. When False, the image is fit to width (Default: `True`).
|
75 |
squeeze_viewport_height_pct: Percentage of the browser viewport height (Default: `75`).
|
76 |
key_original_image: Name of the key under which the input image is shown in the modality selectors (Default: `"Original"`).
|
|
|
|
|
77 |
slider_position: Position of the slider between 0 and 1 (Default: `0.5`).
|
78 |
slider_line_color: Color of the slider line (Default: `"#FFF"`).
|
79 |
slider_line_width: Width of the slider line (Default: `"4px"`).
|
|
|
98 |
self.key_original_image = key_original_image
|
99 |
self.slider_position = slider_position
|
100 |
self.input_keys = None
|
|
|
|
|
|
|
|
|
101 |
self.head = ""
|
102 |
self.head += """
|
103 |
<script>
|
requirements.txt
CHANGED
@@ -1,3 +1,2 @@
|
|
1 |
gradio==4.44.1
|
2 |
gradio_imageslider==0.0.20
|
3 |
-
spaces
|
|
|
1 |
gradio==4.44.1
|
2 |
gradio_imageslider==0.0.20
|
|