Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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>", "<img>")
|
| 453 |
+
texto = texto.replace("<p>", "<p>").replace("</p>", "</p>")
|
| 454 |
+
texto = texto.replace("<div>", "<div>").replace("</div>", "</div>")
|
| 455 |
+
texto = texto.replace("<h1>", "<h1>").replace("</h1>", "</h1>")
|
| 456 |
+
return texto
|
| 457 |
+
|
| 458 |
+
|
| 459 |
def save(self):
|
| 460 |
self.c.save()
|
| 461 |
|