Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,27 +1,16 @@
|
|
| 1 |
-
import
|
| 2 |
-
from
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
# Membuat Antarmuka Gradio
|
| 18 |
-
demo = gr.Interface(
|
| 19 |
-
fn=generate_image,
|
| 20 |
-
inputs=gr.Textbox(label="Masukkan Prompt Anda"),
|
| 21 |
-
outputs=gr.Image(label="Hasil Gambar"),
|
| 22 |
-
title="AI Text-to-Image Generator",
|
| 23 |
-
description="Masukkan deskripsi teks untuk menghasilkan gambar menggunakan Stable Diffusion."
|
| 24 |
-
)
|
| 25 |
-
|
| 26 |
-
if __name__ == "__main__":
|
| 27 |
-
demo.launch()
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
from huggingface_hub import InferenceClient
|
| 3 |
+
|
| 4 |
+
client = InferenceClient(
|
| 5 |
+
provider="together",
|
| 6 |
+
api_key=os.environ["HF_TOKEN"],
|
| 7 |
+
)
|
| 8 |
+
|
| 9 |
+
# output is a PIL.Image object
|
| 10 |
+
image = client.text_to_image(
|
| 11 |
+
"Astronaut riding a horse",
|
| 12 |
+
model="black-forest-labs/FLUX.1-dev",
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
if __name__ == "__main__":
|
| 16 |
+
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|