Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files
main.py
CHANGED
|
@@ -125,38 +125,6 @@ with gr.Blocks() as demo:
|
|
| 125 |
This is a Gradio interface for a ComfyDeploy workflow. You can interact with the deployed model using the inputs below.
|
| 126 |
|
| 127 |
To clone this workflow, visit: [ComfyDeploy Gradio Flux](https://www.comfydeploy.com/share/comfy-deploy-gradio-flux)
|
| 128 |
-
|
| 129 |
-
## Example usage of ComfyDeploy SDK:
|
| 130 |
-
|
| 131 |
-
```python
|
| 132 |
-
from comfydeploy import ComfyDeploy
|
| 133 |
-
import os
|
| 134 |
-
|
| 135 |
-
# Initialize the client
|
| 136 |
-
client = ComfyDeploy(bearer_auth=os.environ['API_KEY'])
|
| 137 |
-
|
| 138 |
-
# Get input definitions
|
| 139 |
-
deployment_id = 'your_deployment_id'
|
| 140 |
-
res = client.deployment.get_input_definition(id=deployment_id)
|
| 141 |
-
input_definitions = res.response_bodies
|
| 142 |
-
|
| 143 |
-
# Run the model
|
| 144 |
-
inputs = {
|
| 145 |
-
'prompt': 'A beautiful landscape',
|
| 146 |
-
'negative_prompt': 'ugly, blurry',
|
| 147 |
-
'width': 512,
|
| 148 |
-
'height': 512
|
| 149 |
-
}
|
| 150 |
-
res = client.run.create(
|
| 151 |
-
request={
|
| 152 |
-
"deployment_id": deployment_id,
|
| 153 |
-
"inputs": inputs
|
| 154 |
-
}
|
| 155 |
-
)
|
| 156 |
-
|
| 157 |
-
# Get the results
|
| 158 |
-
run_id = res.object.run_id
|
| 159 |
-
result = client.run.get(run_id=run_id)
|
| 160 |
""")
|
| 161 |
|
| 162 |
with gr.Row():
|
|
@@ -222,6 +190,36 @@ with gr.Blocks() as demo:
|
|
| 222 |
gr.Gallery(),
|
| 223 |
gr.Textbox(label="Text Output"),
|
| 224 |
]
|
| 225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
if __name__ == "__main__":
|
| 227 |
demo.launch(share=True)
|
|
|
|
| 125 |
This is a Gradio interface for a ComfyDeploy workflow. You can interact with the deployed model using the inputs below.
|
| 126 |
|
| 127 |
To clone this workflow, visit: [ComfyDeploy Gradio Flux](https://www.comfydeploy.com/share/comfy-deploy-gradio-flux)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
""")
|
| 129 |
|
| 130 |
with gr.Row():
|
|
|
|
| 190 |
gr.Gallery(),
|
| 191 |
gr.Textbox(label="Text Output"),
|
| 192 |
]
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
gr.Markdown("""
|
| 196 |
+
## Example usage of ComfyDeploy SDK:
|
| 197 |
+
|
| 198 |
+
```python
|
| 199 |
+
from comfydeploy import ComfyDeploy
|
| 200 |
+
import os
|
| 201 |
+
|
| 202 |
+
# Initialize the client
|
| 203 |
+
client = ComfyDeploy(bearer_auth=os.environ['API_KEY'])
|
| 204 |
+
|
| 205 |
+
# Run the model
|
| 206 |
+
inputs = {
|
| 207 |
+
'prompt': 'A beautiful landscape',
|
| 208 |
+
'negative_prompt': 'ugly, blurry',
|
| 209 |
+
'width': 512,
|
| 210 |
+
'height': 512
|
| 211 |
+
}
|
| 212 |
+
res = client.run.create(
|
| 213 |
+
request={
|
| 214 |
+
"deployment_id": deployment_id,
|
| 215 |
+
"inputs": inputs
|
| 216 |
+
}
|
| 217 |
+
)
|
| 218 |
+
|
| 219 |
+
# Get the results
|
| 220 |
+
run_id = res.object.run_id
|
| 221 |
+
result = client.run.get(run_id=run_id)
|
| 222 |
+
""")
|
| 223 |
+
|
| 224 |
if __name__ == "__main__":
|
| 225 |
demo.launch(share=True)
|