EmoCube commited on
Commit
130e6a7
·
verified ·
1 Parent(s): e92be6e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -8
app.py CHANGED
@@ -15,7 +15,7 @@ API_TOKEN = os.getenv("HF_READ_TOKEN")
15
  headers = {"Authorization": f"Bearer {API_TOKEN}"}
16
  timeout = 100
17
 
18
- def query(prompt, is_negative=False):
19
  if prompt == "" or prompt == None:
20
  return None
21
 
@@ -25,8 +25,7 @@ def query(prompt, is_negative=False):
25
  headers = {"Authorization": f"Bearer {API_TOKEN}"}
26
 
27
  payload = {
28
- "inputs": prompt,
29
- "is_negative": is_negative
30
  }
31
 
32
  response = requests.post(API_URL, headers=headers, json=payload, timeout=timeout)
@@ -79,15 +78,12 @@ with gr.Blocks(theme='gstaff/xkcd', css=css) as app:
79
  with gr.Column(elem_id="prompt-container"):
80
  with gr.Row():
81
  text_prompt = gr.Textbox(label="Prompt", placeholder="Enter a prompt here", lines=2, elem_id="prompt-text-input")
82
- with gr.Row():
83
- with gr.Accordion("Advanced Settings", open=True):
84
- negative_prompt = gr.Textbox(label="Negative Prompt", placeholder="What should not be in the image", value="(deformed, distorted, disfigured), poorly drawn, bad anatomy, wrong anatomy, extra limb, missing limb, floating limbs, (mutated hands and fingers), disconnected limbs, mutation, mutated, ugly, disgusting, blurry, amputation, misspellings, typos", lines=3, elem_id="negative-prompt-text-input")
85
-
86
  with gr.Row():
87
  text_button = gr.Button("Run", variant='primary', elem_id="gen-button")
88
  with gr.Row():
89
  image_output = gr.Image(type="pil", label="Image Output", elem_id="gallery")
90
 
91
- text_button.click(query, inputs=[text_prompt, negative_prompt], outputs=image_output)
92
 
93
  app.launch(show_api=True, share=True)
 
15
  headers = {"Authorization": f"Bearer {API_TOKEN}"}
16
  timeout = 100
17
 
18
+ def query(prompt):
19
  if prompt == "" or prompt == None:
20
  return None
21
 
 
25
  headers = {"Authorization": f"Bearer {API_TOKEN}"}
26
 
27
  payload = {
28
+ "inputs": prompt
 
29
  }
30
 
31
  response = requests.post(API_URL, headers=headers, json=payload, timeout=timeout)
 
78
  with gr.Column(elem_id="prompt-container"):
79
  with gr.Row():
80
  text_prompt = gr.Textbox(label="Prompt", placeholder="Enter a prompt here", lines=2, elem_id="prompt-text-input")
81
+
 
 
 
82
  with gr.Row():
83
  text_button = gr.Button("Run", variant='primary', elem_id="gen-button")
84
  with gr.Row():
85
  image_output = gr.Image(type="pil", label="Image Output", elem_id="gallery")
86
 
87
+ text_button.click(query, inputs=[text_prompt], outputs=image_output)
88
 
89
  app.launch(show_api=True, share=True)