Rooni commited on
Commit
532c267
·
verified ·
1 Parent(s): 8a570a4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -6
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=1, cfg_scale=6, seed=None):
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", value="1girl, c.c., code geass, white shirt, long sleeves, turtleneck, sitting, looking at viewer, eating, pizza, plate, fork, knife, table, chair, table, restaurant, cinematic angle, cinematic lighting, masterpiece, best quality", placeholder="a cute cat", lines=1, elem_id="prompt-text-input")
69
- negative_prompt = gr.Textbox(label="Negative Prompt", value="nsfw, lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, artist name, ", lines=1, elem_id="negative-prompt-text-input")
70
- text_button = gr.Button("Generate", variant='primary', elem_id="gen-button")
71
- image_output = gr.Image(type="pil", label="Output Image", elem_id="gallery")
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)