image generation problem resolved
Browse files- chatbot.py +9 -2
chatbot.py
CHANGED
@@ -305,8 +305,15 @@ def model_inference( user_prompt, chat_history):
|
|
305 |
query = json_data["arguments"]["query"]
|
306 |
gr.Info("Generating Image, Please wait 10 sec...")
|
307 |
yield "Generating Image, Please wait 10 sec..."
|
308 |
-
|
309 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
310 |
|
311 |
elif json_data["name"] == "video_generation":
|
312 |
query = json_data["arguments"]["query"]
|
|
|
305 |
query = json_data["arguments"]["query"]
|
306 |
gr.Info("Generating Image, Please wait 10 sec...")
|
307 |
yield "Generating Image, Please wait 10 sec..."
|
308 |
+
try:
|
309 |
+
image = image_gen(f"{str(query)}")
|
310 |
+
yield gr.Image(image[1])
|
311 |
+
except:
|
312 |
+
client_sd3 = InferenceClient("stabilityai/stable-diffusion-3-medium-diffusers")
|
313 |
+
seed = random.randint(0,999999)
|
314 |
+
image = client_sd3.text_to_image(query, negative_prompt=f"{seed}")
|
315 |
+
yield gr.Image(image)
|
316 |
+
|
317 |
|
318 |
elif json_data["name"] == "video_generation":
|
319 |
query = json_data["arguments"]["query"]
|