Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,12 +8,11 @@ from PIL import Image
|
|
| 8 |
from deep_translator import GoogleTranslator
|
| 9 |
import json
|
| 10 |
|
| 11 |
-
# Project by TotoB12
|
| 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 =
|
| 17 |
|
| 18 |
# Function to query the API and return the generated image
|
| 19 |
def query(prompt, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, strength=0.7, width=1024, height=1024):
|
|
@@ -71,7 +70,7 @@ css = """
|
|
| 71 |
# Build the Gradio UI with Blocks
|
| 72 |
with gr.Blocks(css=css) as app:
|
| 73 |
# Add a title to the app
|
| 74 |
-
gr.HTML("<center><h1>
|
| 75 |
|
| 76 |
# Container for all the UI elements
|
| 77 |
with gr.Column(elem_id="app-container"):
|
|
@@ -86,8 +85,8 @@ with gr.Blocks(css=css) as app:
|
|
| 86 |
with gr.Accordion("Advanced Settings", open=False):
|
| 87 |
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")
|
| 88 |
with gr.Row():
|
| 89 |
-
width = gr.Slider(label="Width", value=1024, minimum=64, maximum=
|
| 90 |
-
height = gr.Slider(label="Height", value=1024, minimum=64, maximum=
|
| 91 |
steps = gr.Slider(label="Sampling steps", value=4, minimum=1, maximum=100, step=1)
|
| 92 |
cfg = gr.Slider(label="CFG Scale", value=7, minimum=1, maximum=20, step=1)
|
| 93 |
strength = gr.Slider(label="Strength", value=0.7, minimum=0, maximum=1, step=0.001)
|
|
|
|
| 8 |
from deep_translator import GoogleTranslator
|
| 9 |
import json
|
| 10 |
|
|
|
|
| 11 |
|
| 12 |
+
API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-3.5-large"
|
| 13 |
API_TOKEN = os.getenv("HF_READ_TOKEN")
|
| 14 |
headers = {"Authorization": f"Bearer {API_TOKEN}"}
|
| 15 |
+
timeout = 1000
|
| 16 |
|
| 17 |
# Function to query the API and return the generated image
|
| 18 |
def query(prompt, is_negative=False, steps=30, cfg_scale=7, sampler="DPM++ 2M Karras", seed=-1, strength=0.7, width=1024, height=1024):
|
|
|
|
| 70 |
# Build the Gradio UI with Blocks
|
| 71 |
with gr.Blocks(css=css) as app:
|
| 72 |
# Add a title to the app
|
| 73 |
+
gr.HTML("<center><h1>SDXL 3.5</h1></center>")
|
| 74 |
|
| 75 |
# Container for all the UI elements
|
| 76 |
with gr.Column(elem_id="app-container"):
|
|
|
|
| 85 |
with gr.Accordion("Advanced Settings", open=False):
|
| 86 |
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")
|
| 87 |
with gr.Row():
|
| 88 |
+
width = gr.Slider(label="Width", value=1024, minimum=64, maximum=2048, step=32)
|
| 89 |
+
height = gr.Slider(label="Height", value=1024, minimum=64, maximum=2048, step=32)
|
| 90 |
steps = gr.Slider(label="Sampling steps", value=4, minimum=1, maximum=100, step=1)
|
| 91 |
cfg = gr.Slider(label="CFG Scale", value=7, minimum=1, maximum=20, step=1)
|
| 92 |
strength = gr.Slider(label="Strength", value=0.7, minimum=0, maximum=1, step=0.001)
|