mariusjabami commited on
Commit
c3356b3
·
verified ·
1 Parent(s): 57efede

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -443,11 +443,19 @@ class Model():
443
  sleep(3)
444
  print("Gerando...")
445
  res = self.oppo.models.generate_content(model="gemma-3-27b-it", contents=prompt)
446
- return res.text
447
  except Exception as e:
448
  print("erro:", e)
449
  print("Tentando novamente")
450
 
 
 
 
 
 
 
 
 
451
  def save(self):
452
  self.c.save()
453
 
 
443
  sleep(3)
444
  print("Gerando...")
445
  res = self.oppo.models.generate_content(model="gemma-3-27b-it", contents=prompt)
446
+ return self.limpar(res.text)
447
  except Exception as e:
448
  print("erro:", e)
449
  print("Tentando novamente")
450
 
451
+ def limpar(self, texto):
452
+ texto = texto.replace("<img>", "&lt;img&gt;")
453
+ texto = texto.replace("<p>", "&lt;p&gt;").replace("</p>", "&lt;/p&gt;")
454
+ texto = texto.replace("<div>", "&lt;div&gt;").replace("</div>", "&lt;/div&gt;")
455
+ texto = texto.replace("<h1>", "&lt;h1&gt;").replace("</h1>", "&lt;/h1&gt;")
456
+ return texto
457
+
458
+
459
  def save(self):
460
  self.c.save()
461