KingNish commited on
Commit
48191bb
1 Parent(s): 8f0d7a2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -143,13 +143,11 @@ def respond(message, history):
143
  elif json_data["name"] == "image_generation":
144
  query = json_data["arguments"]["query"]
145
  gr.Info("Generating Image, Please wait 10 sec...")
146
- seed = random.randint(1, 99999)
147
- image = f"![](https://image.pollinations.ai/prompt/{message_text}{query}?seed={seed}&nologo=True)"
148
- image = image.replace("\\n", "")
149
- image = image.replace(" ", "%20")
150
- yield image
151
- time.sleep(8)
152
- gr.Info("We are going to Update Our Image Generation Engine to more powerful ones in Next Update. ThankYou")
153
  elif json_data["name"] == "image_qna":
154
  inputs = llava(message, history)
155
  streamer = TextIteratorStreamer(processor, skip_prompt=True, **{"skip_special_tokens": True})
 
143
  elif json_data["name"] == "image_generation":
144
  query = json_data["arguments"]["query"]
145
  gr.Info("Generating Image, Please wait 10 sec...")
146
+ client = InferenceClient("stabilityai/stable-diffusion-3-medium-diffusers")
147
+ seed = random.randint(0.999999)
148
+ image = client.text_to_image(message_text, negative_prompt=f"{seed}")
149
+ yield gr.Image(image)
150
+ gr.Info("We are going to mor upgrade image generator in next update")
 
 
151
  elif json_data["name"] == "image_qna":
152
  inputs = llava(message, history)
153
  streamer = TextIteratorStreamer(processor, skip_prompt=True, **{"skip_special_tokens": True})