raannakasturi commited on
Commit
82d7e57
·
1 Parent(s): 4fb7253

Update image generation to use new providers and adjust model name for improved performance

Browse files
Files changed (1) hide show
  1. image.py +5 -3
image.py CHANGED
@@ -6,7 +6,9 @@ import requests
6
  from urllib.parse import quote
7
  from PIL import Image
8
  from g4f.client import Client
9
- from g4f.Provider import RetryProvider, Blackbox, BlackboxCreateAgent, PollinationsAI, Airforce
 
 
10
 
11
  def extract_summary(text):
12
  text = text.replace("#", "").strip().lower()
@@ -30,14 +32,14 @@ def generate_image(title, category):
30
  prompt = quote(f"Generate accurate image representing the concept: ```((( {category}))) {title.strip() }```")
31
  client = Client(
32
  image_provider=RetryProvider(
33
- providers=[PollinationsAI, Airforce],
34
  shuffle=True,
35
  single_provider_retry=True,
36
  max_retries=3,
37
  )
38
  )
39
  img_data = client.images.generate(
40
- model="flux-pro",
41
  prompt=prompt,
42
  negative_prompt=negative,
43
  response_format="b64_json",
 
6
  from urllib.parse import quote
7
  from PIL import Image
8
  from g4f.client import Client
9
+ from g4f.Provider import RetryProvider, PollinationsAI, Airforce
10
+ from g4f.Provider.hf_space.BlackForestLabsFlux1Schnell import BlackForestLabsFlux1Schnell
11
+ from g4f.Provider.hf_space.VoodoohopFlux1Schnell import VoodoohopFlux1Schnell
12
 
13
  def extract_summary(text):
14
  text = text.replace("#", "").strip().lower()
 
32
  prompt = quote(f"Generate accurate image representing the concept: ```((( {category}))) {title.strip() }```")
33
  client = Client(
34
  image_provider=RetryProvider(
35
+ providers=[BlackForestLabsFlux1Schnell, VoodoohopFlux1Schnell],
36
  shuffle=True,
37
  single_provider_retry=True,
38
  max_retries=3,
39
  )
40
  )
41
  img_data = client.images.generate(
42
+ model="flux-schnell",
43
  prompt=prompt,
44
  negative_prompt=negative,
45
  response_format="b64_json",