Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,8 +13,9 @@ print("Model loaded successfully.")
|
|
| 13 |
|
| 14 |
def generate_image(prompt, prompt_name):
|
| 15 |
try:
|
| 16 |
-
print(f"Generating image for {prompt_name}")
|
| 17 |
output = model(prompt=prompt, num_inference_steps=1, guidance_scale=0.0)
|
|
|
|
| 18 |
|
| 19 |
if output and hasattr(output, 'images') and output.images:
|
| 20 |
print(f"Image generated for {prompt_name}")
|
|
@@ -48,7 +49,7 @@ async def queue_api_calls(sentence_mapping, character_dict, selected_style):
|
|
| 48 |
responses = await asyncio.gather(*tasks)
|
| 49 |
|
| 50 |
images = {paragraph_number: response for (paragraph_number, _), response in zip(prompts, responses)}
|
| 51 |
-
print("Finished queuing API calls.")
|
| 52 |
return images
|
| 53 |
|
| 54 |
def process_prompt(sentence_mapping, character_dict, selected_style):
|
|
@@ -65,7 +66,7 @@ def process_prompt(sentence_mapping, character_dict, selected_style):
|
|
| 65 |
print("Created new event loop.")
|
| 66 |
|
| 67 |
cmpt_return = loop.run_until_complete(queue_api_calls(sentence_mapping, character_dict, selected_style))
|
| 68 |
-
print("Prompt processing complete.")
|
| 69 |
return cmpt_return
|
| 70 |
|
| 71 |
gradio_interface = gr.Interface(
|
|
|
|
| 13 |
|
| 14 |
def generate_image(prompt, prompt_name):
|
| 15 |
try:
|
| 16 |
+
print(f"Generating image for {prompt_name} with prompt: {prompt}")
|
| 17 |
output = model(prompt=prompt, num_inference_steps=1, guidance_scale=0.0)
|
| 18 |
+
print(f"Model output for {prompt_name}: {output}")
|
| 19 |
|
| 20 |
if output and hasattr(output, 'images') and output.images:
|
| 21 |
print(f"Image generated for {prompt_name}")
|
|
|
|
| 49 |
responses = await asyncio.gather(*tasks)
|
| 50 |
|
| 51 |
images = {paragraph_number: response for (paragraph_number, _), response in zip(prompts, responses)}
|
| 52 |
+
print("Finished queuing API calls. Generated images: ", images)
|
| 53 |
return images
|
| 54 |
|
| 55 |
def process_prompt(sentence_mapping, character_dict, selected_style):
|
|
|
|
| 66 |
print("Created new event loop.")
|
| 67 |
|
| 68 |
cmpt_return = loop.run_until_complete(queue_api_calls(sentence_mapping, character_dict, selected_style))
|
| 69 |
+
print("Prompt processing complete. Generated images: ", cmpt_return)
|
| 70 |
return cmpt_return
|
| 71 |
|
| 72 |
gradio_interface = gr.Interface(
|