Ryadg commited on
Commit
413ab6b
·
1 Parent(s): 3e0f4f1

fix: FLUX.2-klein prompt keyword arg, image for all verdicts

Browse files
Files changed (2) hide show
  1. app.py +4 -10
  2. core/image_gen.py +2 -2
app.py CHANGED
@@ -345,18 +345,12 @@ def submit_answer(question, chunk, student_answer, correct, total, language):
345
  return f"Erreur : {e}", correct, total, _score_label(correct, total)
346
 
347
 
348
- def _is_positive_verdict(feedback: str) -> bool:
349
- """True for Correct or Partially Correct verdicts (not Incorrect / errors)."""
350
- for line in feedback.splitlines():
351
- low = line.lower()
352
- if "verdict" in low:
353
- return "correct" in low and "incorrect" not in low
354
- return False
355
-
356
-
357
  @spaces.GPU(duration=60)
358
  def generate_image_fn(question, feedback):
359
- if not question or not _is_positive_verdict(feedback):
 
 
 
360
  return None
361
  try:
362
  concept = question.strip().replace("\n", " ")[:200]
 
345
  return f"Erreur : {e}", correct, total, _score_label(correct, total)
346
 
347
 
 
 
 
 
 
 
 
 
 
348
  @spaces.GPU(duration=60)
349
  def generate_image_fn(question, feedback):
350
+ if not question or not feedback:
351
+ return None
352
+ low = feedback.strip().lower()
353
+ if low.startswith("erreur") or low.startswith("⚠"):
354
  return None
355
  try:
356
  concept = question.strip().replace("\n", " ")[:200]
core/image_gen.py CHANGED
@@ -30,10 +30,10 @@ def generate_concept_image(concept: str) -> Image.Image:
30
  "scientific diagram style"
31
  )
32
  result = pipe(
33
- prompt,
34
  height=512,
35
  width=512,
36
  num_inference_steps=4,
37
- guidance_scale=0.0,
38
  )
39
  return result.images[0]
 
30
  "scientific diagram style"
31
  )
32
  result = pipe(
33
+ prompt=prompt,
34
  height=512,
35
  width=512,
36
  num_inference_steps=4,
37
+ guidance_scale=1.0,
38
  )
39
  return result.images[0]