Update app.py
Browse files
app.py
CHANGED
|
@@ -9,8 +9,9 @@ def gerar_texto(texto_inicial):
|
|
| 9 |
seed = random.randint(100, 1000000)
|
| 10 |
set_seed(seed)
|
| 11 |
|
|
|
|
| 12 |
if texto_inicial == "":
|
| 13 |
-
texto_inicial = line[random.randrange(0, len(line))].replace("\n", "").
|
| 14 |
texto_inicial = re.sub(r"[,:\-–.!;?_]", '', texto_inicial)
|
| 15 |
|
| 16 |
response = gpt2_pipe(texto_inicial, max_length=(len(texto_inicial) + random.randint(60, 90)), num_return_sequences=4)
|
|
@@ -27,12 +28,12 @@ def gerar_texto(texto_inicial):
|
|
| 27 |
if response_end != "":
|
| 28 |
return response_end
|
| 29 |
|
| 30 |
-
txt = grad.Textbox(lines=1, label="Texto Inicial", placeholder="Digite o texto
|
| 31 |
out = grad.Textbox(lines=4, label="Prompts Gerados")
|
| 32 |
|
| 33 |
exemplos = []
|
| 34 |
for x in range(8):
|
| 35 |
-
exemplos.append(line[random.randrange(0, len(line))].replace("\n", "").
|
| 36 |
|
| 37 |
titulo = "Gerador de Prompt de Difusão Estável"
|
| 38 |
descricao = 'Este é um demo da série de modelos: "MagicPrompt", neste caso, focado em: "Difusão Estável". Para utilizá-lo, simplesmente insira seu texto ou clique em um dos exemplos. Para saber mais sobre o modelo, [clique aqui](https://huggingface.co/Gustavosta/MagicPrompt-Stable-Diffusion).<br>'
|
|
|
|
| 9 |
seed = random.randint(100, 1000000)
|
| 10 |
set_seed(seed)
|
| 11 |
|
| 12 |
+
# Se o texto inicial estiver vazio, selecione aleatoriamente uma linha do arquivo "ideas.txt" (em português)
|
| 13 |
if texto_inicial == "":
|
| 14 |
+
texto_inicial = line[random.randrange(0, len(line))].replace("\n", "").capitalize()
|
| 15 |
texto_inicial = re.sub(r"[,:\-–.!;?_]", '', texto_inicial)
|
| 16 |
|
| 17 |
response = gpt2_pipe(texto_inicial, max_length=(len(texto_inicial) + random.randint(60, 90)), num_return_sequences=4)
|
|
|
|
| 28 |
if response_end != "":
|
| 29 |
return response_end
|
| 30 |
|
| 31 |
+
txt = grad.Textbox(lines=1, label="Texto Inicial", placeholder="Digite o texto aqui")
|
| 32 |
out = grad.Textbox(lines=4, label="Prompts Gerados")
|
| 33 |
|
| 34 |
exemplos = []
|
| 35 |
for x in range(8):
|
| 36 |
+
exemplos.append(line[random.randrange(0, len(line))].replace("\n", "").capitalize())
|
| 37 |
|
| 38 |
titulo = "Gerador de Prompt de Difusão Estável"
|
| 39 |
descricao = 'Este é um demo da série de modelos: "MagicPrompt", neste caso, focado em: "Difusão Estável". Para utilizá-lo, simplesmente insira seu texto ou clique em um dos exemplos. Para saber mais sobre o modelo, [clique aqui](https://huggingface.co/Gustavosta/MagicPrompt-Stable-Diffusion).<br>'
|