Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -13,6 +13,8 @@ sys.path.append(os.path.abspath(os.path.dirname(__file__)))
|
|
13 |
|
14 |
print("Current working directory:", os.getcwd())
|
15 |
print("Absolute path of app.py:", os.path.abspath(os.path.dirname(__file__)))
|
|
|
|
|
16 |
|
17 |
hf_hub_download(
|
18 |
repo_id="Comfy-Org/stable-diffusion-v1-5-archive",
|
@@ -91,9 +93,9 @@ def add_extra_model_paths() -> None:
|
|
91 |
print(
|
92 |
"Could not import load_extra_path_config from main.py. Looking in utils.extra_config instead."
|
93 |
)
|
94 |
-
|
95 |
-
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "utils")))
|
96 |
-
from extra_config import load_extra_path_config
|
97 |
|
98 |
extra_model_paths = find_path("extra_model_paths.yaml")
|
99 |
|
@@ -183,33 +185,31 @@ def generate_image(positive_prompt, negative_prompt):
|
|
183 |
)
|
184 |
saved_path=f"output/{saveimage_9['ui']['images'][0]['filename']}"
|
185 |
return saved_path
|
186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
|
188 |
if __name__ == "__main__":
|
189 |
-
# Start your Gradio app
|
190 |
-
with gr.Blocks() as app:
|
191 |
-
# Add a title
|
192 |
-
gr.Markdown("# FLUX Style Shaping")
|
193 |
-
|
194 |
-
with gr.Row():
|
195 |
-
with gr.Column():
|
196 |
-
# Add an input
|
197 |
-
positive_prompt_input = gr.Textbox(label="Positive Prompt", placeholder="Enter your positive prompt here...")
|
198 |
-
negative_prompt_input = gr.Textbox(label="Negative Prompt", placeholder="Enter your negative prompt here...")
|
199 |
-
# The generate button
|
200 |
-
generate_btn = gr.Button("Generate")
|
201 |
-
|
202 |
-
with gr.Column():
|
203 |
-
# The output image
|
204 |
-
output_image = gr.Image(label="Generated Image")
|
205 |
-
|
206 |
-
# When clicking the button, it will trigger the `generate_image` function, with the respective inputs
|
207 |
-
# and the output an image
|
208 |
-
generate_btn.click(
|
209 |
-
fn=generate_image,
|
210 |
-
inputs=[positive_prompt_input, negative_prompt_input],
|
211 |
-
outputs=[output_image]
|
212 |
-
)
|
213 |
app.launch(share=True)
|
214 |
-
|
215 |
-
|
|
|
13 |
|
14 |
print("Current working directory:", os.getcwd())
|
15 |
print("Absolute path of app.py:", os.path.abspath(os.path.dirname(__file__)))
|
16 |
+
utils_path = os.path.abspath('utils')
|
17 |
+
print(f"The absolute path of 'utils' is: {utils_path}")
|
18 |
|
19 |
hf_hub_download(
|
20 |
repo_id="Comfy-Org/stable-diffusion-v1-5-archive",
|
|
|
93 |
print(
|
94 |
"Could not import load_extra_path_config from main.py. Looking in utils.extra_config instead."
|
95 |
)
|
96 |
+
from utils.extra_config import load_extra_path_config
|
97 |
+
# sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "utils")))
|
98 |
+
# from extra_config import load_extra_path_config
|
99 |
|
100 |
extra_model_paths = find_path("extra_model_paths.yaml")
|
101 |
|
|
|
185 |
)
|
186 |
saved_path=f"output/{saveimage_9['ui']['images'][0]['filename']}"
|
187 |
return saved_path
|
188 |
+
|
189 |
+
# Start your Gradio app
|
190 |
+
with gr.Blocks() as app:
|
191 |
+
# Add a title
|
192 |
+
gr.Markdown("# FLUX Style Shaping")
|
193 |
+
|
194 |
+
with gr.Row():
|
195 |
+
with gr.Column():
|
196 |
+
# Add an input
|
197 |
+
positive_prompt_input = gr.Textbox(label="Positive Prompt", placeholder="Enter your positive prompt here...")
|
198 |
+
negative_prompt_input = gr.Textbox(label="Negative Prompt", placeholder="Enter your negative prompt here...")
|
199 |
+
# The generate button
|
200 |
+
generate_btn = gr.Button("Generate")
|
201 |
+
|
202 |
+
with gr.Column():
|
203 |
+
# The output image
|
204 |
+
output_image = gr.Image(label="Generated Image")
|
205 |
+
|
206 |
+
# When clicking the button, it will trigger the `generate_image` function, with the respective inputs
|
207 |
+
# and the output an image
|
208 |
+
generate_btn.click(
|
209 |
+
fn=generate_image,
|
210 |
+
inputs=[positive_prompt_input, negative_prompt_input],
|
211 |
+
outputs=[output_image]
|
212 |
+
)
|
213 |
|
214 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
app.launch(share=True)
|
|
|
|