Spaces:
Running
Running
salomonsky
commited on
Commit
•
cef5432
1
Parent(s):
8b0cb31
Update app.py
Browse files
app.py
CHANGED
@@ -13,10 +13,12 @@ client = AsyncInferenceClient()
|
|
13 |
DATA_PATH = Path("./data")
|
14 |
DATA_PATH.mkdir(exist_ok=True)
|
15 |
|
|
|
|
|
16 |
async def generate_image(prompt, width, height, seed):
|
17 |
try:
|
18 |
if seed == -1:
|
19 |
-
seed =
|
20 |
seed = int(seed)
|
21 |
image = await client.text_to_image(
|
22 |
prompt=prompt, height=height, width=width, model="enhanceaiteam/Flux-uncensored"
|
@@ -35,12 +37,10 @@ def save_prompt(prompt_text, seed):
|
|
35 |
st.error(f"Error al guardar el prompt: {e}")
|
36 |
return None
|
37 |
|
38 |
-
async def gen(prompt, width, height
|
39 |
combined_prompt = prompt
|
40 |
|
41 |
-
|
42 |
-
seed = random.randint(0, MAX_SEED)
|
43 |
-
seed = int(seed)
|
44 |
progress_bar = st.progress(0)
|
45 |
image, seed = await generate_image(combined_prompt, width, height, seed)
|
46 |
progress_bar.progress(100)
|
@@ -88,7 +88,7 @@ def main():
|
|
88 |
|
89 |
if st.sidebar.button("Generar Imagen"):
|
90 |
with st.spinner("Generando imagen..."):
|
91 |
-
result = asyncio.run(gen(prompt, width, height
|
92 |
image_paths = result[0]
|
93 |
prompt_file = result[1]
|
94 |
|
|
|
13 |
DATA_PATH = Path("./data")
|
14 |
DATA_PATH.mkdir(exist_ok=True)
|
15 |
|
16 |
+
PREDEFINED_SEED = random.randint(0, MAX_SEED)
|
17 |
+
|
18 |
async def generate_image(prompt, width, height, seed):
|
19 |
try:
|
20 |
if seed == -1:
|
21 |
+
seed = PREDEFINED_SEED
|
22 |
seed = int(seed)
|
23 |
image = await client.text_to_image(
|
24 |
prompt=prompt, height=height, width=width, model="enhanceaiteam/Flux-uncensored"
|
|
|
37 |
st.error(f"Error al guardar el prompt: {e}")
|
38 |
return None
|
39 |
|
40 |
+
async def gen(prompt, width, height):
|
41 |
combined_prompt = prompt
|
42 |
|
43 |
+
seed = PREDEFINED_SEED
|
|
|
|
|
44 |
progress_bar = st.progress(0)
|
45 |
image, seed = await generate_image(combined_prompt, width, height, seed)
|
46 |
progress_bar.progress(100)
|
|
|
88 |
|
89 |
if st.sidebar.button("Generar Imagen"):
|
90 |
with st.spinner("Generando imagen..."):
|
91 |
+
result = asyncio.run(gen(prompt, width, height))
|
92 |
image_paths = result[0]
|
93 |
prompt_file = result[1]
|
94 |
|