Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,16 @@
|
|
1 |
from transformers import pipeline
|
|
|
2 |
|
3 |
-
#
|
4 |
-
|
|
|
5 |
|
6 |
-
#
|
|
|
|
|
|
|
|
|
7 |
generated_image = generator("A futuristic city")
|
8 |
-
|
|
|
|
|
|
1 |
from transformers import pipeline
|
2 |
+
from huggingface_hub import login
|
3 |
|
4 |
+
# Login to Hugging Face with your API key
|
5 |
+
api_key = 'your-huggingface-api-key'
|
6 |
+
login(token=api_key)
|
7 |
|
8 |
+
# Initialize the pipeline with a correct model identifier
|
9 |
+
# Here I'm using a popular image generation model like 'stable-diffusion'
|
10 |
+
generator = pipeline('image-generation', model='CompVis/stable-diffusion-v1-4-original', use_auth_token=api_key)
|
11 |
+
|
12 |
+
# Generate an image from a text prompt
|
13 |
generated_image = generator("A futuristic city")
|
14 |
+
|
15 |
+
# Show the generated image
|
16 |
+
generated_image[0]['image'].show()
|