Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ API_URL = "https://api-inference.huggingface.co/models/cagliostrolab/animagine-x
|
|
10 |
API_TOKEN = os.getenv("HF_READ_TOKEN") # it is free
|
11 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
12 |
|
13 |
-
def query(prompt, is_negative=False, steps=
|
14 |
payload = {
|
15 |
"inputs": prompt,
|
16 |
"is_negative": is_negative,
|
@@ -49,6 +49,9 @@ css = """
|
|
49 |
.svelte-15lo0d8 {
|
50 |
flex-direction: column !important;
|
51 |
}
|
|
|
|
|
|
|
52 |
"""
|
53 |
|
54 |
with gr.Blocks(css=css) as Animagine:
|
@@ -65,9 +68,9 @@ with gr.Blocks(css=css) as Animagine:
|
|
65 |
)
|
66 |
with gr.Row():
|
67 |
with gr.Column(elem_id="prompt-container"):
|
68 |
-
text_prompt = gr.Textbox(label="Prompt",
|
69 |
-
negative_prompt = gr.Textbox(label="Negative Prompt",
|
70 |
-
text_button = gr.Button("
|
71 |
-
image_output = gr.Image(type="pil", label="
|
72 |
text_button.click(query, inputs=[text_prompt, negative_prompt], outputs=image_output)
|
73 |
-
Animagine.launch(show_api=False)
|
|
|
10 |
API_TOKEN = os.getenv("HF_READ_TOKEN") # it is free
|
11 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
12 |
|
13 |
+
def query(prompt, is_negative=False, steps=37, cfg_scale=8, seed=None):
|
14 |
payload = {
|
15 |
"inputs": prompt,
|
16 |
"is_negative": is_negative,
|
|
|
49 |
.svelte-15lo0d8 {
|
50 |
flex-direction: column !important;
|
51 |
}
|
52 |
+
.footer {
|
53 |
+
display: none;
|
54 |
+
}
|
55 |
"""
|
56 |
|
57 |
with gr.Blocks(css=css) as Animagine:
|
|
|
68 |
)
|
69 |
with gr.Row():
|
70 |
with gr.Column(elem_id="prompt-container"):
|
71 |
+
text_prompt = gr.Textbox(label="Prompt", placeholder="Описание изображения", lines=1, elem_id="prompt-text-input")
|
72 |
+
negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="Чего не должно быть на изображении", value="[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry", lines=1, elem_id="negative-prompt-text-input")
|
73 |
+
text_button = gr.Button("Генерировать", variant='primary', elem_id="gen-button")
|
74 |
+
image_output = gr.Image(type="pil", label="Сгенерированое изображение", elem_id="gallery")
|
75 |
text_button.click(query, inputs=[text_prompt, negative_prompt], outputs=image_output)
|
76 |
+
Animagine.launch(queue, show_api=False)
|