Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,17 @@
|
|
1 |
from transformers import pipeline
|
2 |
-
from huggingface_hub import login
|
3 |
|
4 |
-
#
|
5 |
-
api_key =
|
6 |
-
login(token=api_key)
|
7 |
|
8 |
-
# Initialize the pipeline
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
11 |
|
12 |
-
# Generate an image
|
13 |
-
|
14 |
|
15 |
-
#
|
16 |
-
|
|
|
1 |
from transformers import pipeline
|
|
|
2 |
|
3 |
+
# Define your API key
|
4 |
+
api_key = "your_huggingface_api_key"
|
|
|
5 |
|
6 |
+
# Initialize the pipeline using the API key
|
7 |
+
generator = pipeline(
|
8 |
+
"image-generation",
|
9 |
+
model="CompVis/stable-diffusion-v1-4-original",
|
10 |
+
use_auth_token=api_key
|
11 |
+
)
|
12 |
|
13 |
+
# Generate an image
|
14 |
+
result = generator("A futuristic city")
|
15 |
|
16 |
+
# Display the generated image
|
17 |
+
result[0]["image"].show()
|