Update app.py
Browse files
app.py
CHANGED
@@ -8,14 +8,13 @@ from PIL import Image
|
|
8 |
from deep_translator import GoogleTranslator
|
9 |
import json
|
10 |
|
11 |
-
# Project by Nymbo
|
12 |
|
13 |
-
API_URL = "https://api-inference.huggingface.co/models/
|
14 |
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, steps=
|
19 |
if prompt == "" or prompt == None:
|
20 |
return None
|
21 |
|
@@ -32,11 +31,9 @@ def query(prompt, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Ka
|
|
32 |
|
33 |
payload = {
|
34 |
"inputs": prompt,
|
35 |
-
"is_negative": is_negative,
|
36 |
"steps": steps,
|
37 |
"cfg_scale": cfg_scale,
|
38 |
"seed": seed if seed != -1 else random.randint(1, 1000000000),
|
39 |
-
"strength": strength
|
40 |
}
|
41 |
|
42 |
response = requests.post(API_URL, headers=headers, json=payload, timeout=timeout)
|
@@ -74,8 +71,8 @@ with gr.Blocks(theme='Nymbo/Nymbo_Theme', css=css) as app:
|
|
74 |
with gr.Row():
|
75 |
with gr.Accordion("Advanced Settings", open=False):
|
76 |
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")
|
77 |
-
steps = gr.Slider(label="Sampling steps", value=
|
78 |
-
cfg = gr.Slider(label="CFG Scale", value=
|
79 |
method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
|
80 |
strength = gr.Slider(label="Strength", value=0.7, minimum=0, maximum=1, step=0.001)
|
81 |
seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
|
|
|
8 |
from deep_translator import GoogleTranslator
|
9 |
import json
|
10 |
|
|
|
11 |
|
12 |
+
API_URL = "https://api-inference.huggingface.co/models/ovi054/rmx_flux"
|
13 |
API_TOKEN = os.getenv("HF_READ_TOKEN")
|
14 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
15 |
timeout = 100
|
16 |
|
17 |
+
def query(prompt, is_negative=False, steps=28, cfg_scale=3.5, sampler="DPM++ 2M Karras", seed=-1, strength=0.7):
|
18 |
if prompt == "" or prompt == None:
|
19 |
return None
|
20 |
|
|
|
31 |
|
32 |
payload = {
|
33 |
"inputs": prompt,
|
|
|
34 |
"steps": steps,
|
35 |
"cfg_scale": cfg_scale,
|
36 |
"seed": seed if seed != -1 else random.randint(1, 1000000000),
|
|
|
37 |
}
|
38 |
|
39 |
response = requests.post(API_URL, headers=headers, json=payload, timeout=timeout)
|
|
|
71 |
with gr.Row():
|
72 |
with gr.Accordion("Advanced Settings", open=False):
|
73 |
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")
|
74 |
+
steps = gr.Slider(label="Sampling steps", value=28, minimum=1, maximum=100, step=1)
|
75 |
+
cfg = gr.Slider(label="CFG Scale", value=3.5, minimum=1, maximum=20, step=0.5)
|
76 |
method = gr.Radio(label="Sampling method", value="DPM++ 2M Karras", choices=["DPM++ 2M Karras", "DPM++ SDE Karras", "Euler", "Euler a", "Heun", "DDIM"])
|
77 |
strength = gr.Slider(label="Strength", value=0.7, minimum=0, maximum=1, step=0.001)
|
78 |
seed = gr.Slider(label="Seed", value=-1, minimum=-1, maximum=1000000000, step=1)
|