Spaces:
Running
Running
salomonsky
commited on
Commit
•
d726a64
1
Parent(s):
8b0fc18
Update app.py
Browse files
app.py
CHANGED
@@ -52,13 +52,13 @@ async def gen(prompt, basemodel, w, h, scales, steps, seed, upscale_factor, proc
|
|
52 |
upscale_image_path = get_upscale_finegrain(combined_prompt, image_path, upscale_factor)
|
53 |
if upscale_image_path:
|
54 |
Image.open(upscale_image_path).save(DATA_PATH / f"upscale_image_{seed}.jpg", format="JPEG")
|
55 |
-
image_path.unlink()
|
56 |
return [str(DATA_PATH / f"upscale_image_{seed}.jpg"), str(prompt_file_path)]
|
57 |
return [str(image_path), str(prompt_file_path)]
|
58 |
|
59 |
async def improve_prompt(prompt, language):
|
60 |
instruction = "With this idea, describe in English a detailed txt2img prompt in 500 characters at most..." if language == "en" else "Con esta idea, describe en español un prompt detallado de txt2img..."
|
61 |
-
response =
|
62 |
return response.get('generated_text', '').strip()[:500]
|
63 |
|
64 |
def save_image(image, seed):
|
|
|
52 |
upscale_image_path = get_upscale_finegrain(combined_prompt, image_path, upscale_factor)
|
53 |
if upscale_image_path:
|
54 |
Image.open(upscale_image_path).save(DATA_PATH / f"upscale_image_{seed}.jpg", format="JPEG")
|
55 |
+
image_path.unlink()
|
56 |
return [str(DATA_PATH / f"upscale_image_{seed}.jpg"), str(prompt_file_path)]
|
57 |
return [str(image_path), str(prompt_file_path)]
|
58 |
|
59 |
async def improve_prompt(prompt, language):
|
60 |
instruction = "With this idea, describe in English a detailed txt2img prompt in 500 characters at most..." if language == "en" else "Con esta idea, describe en español un prompt detallado de txt2img..."
|
61 |
+
response = llm_client.text_generation(f"{prompt}: {instruction}", max_new_tokens=500)
|
62 |
return response.get('generated_text', '').strip()[:500]
|
63 |
|
64 |
def save_image(image, seed):
|