Spaces:
Sleeping
Sleeping
Commit
·
e22dc2d
1
Parent(s):
314cf1c
Subindo arquivos
Browse files- .gitattributes +0 -35
- Manual_PseudocodeLab.pdf +0 -0
- README.md +39 -6
- app.py +237 -0
- requirements.txt +3 -0
.gitattributes
DELETED
|
@@ -1,35 +0,0 @@
|
|
| 1 |
-
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
-
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
-
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Manual_PseudocodeLab.pdf
ADDED
|
Binary file (83.2 kB). View file
|
|
|
README.md
CHANGED
|
@@ -1,13 +1,46 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 4.
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: ecl-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: PseudocodeLab
|
| 3 |
+
emoji: 🖥️🇧🇷🦀
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: pink
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 4.12.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: ecl-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
+
## Language
|
| 14 |
+
Portuguese (Brazilian)
|
| 15 |
+
|
| 16 |
+
## Informação
|
| 17 |
+
|
| 18 |
+
Este interpretador é uma ferramenta criada para auxiliar na interpretação de pseudocódigo, transformando as instruções fornecidas em execução ou validaçãodo código. Foi desenvolvido com o objetivo de auxiliar estudantes e profissionais que estão aprendendo/ensinando lógica de programação.
|
| 19 |
+
|
| 20 |
+
## Funcionamento
|
| 21 |
+
|
| 22 |
+
1. Digite ou cole o pseudocódigo na área de texto.
|
| 23 |
+
2. Pressione o botão de Submit.
|
| 24 |
+
3. O resultado da interpretação será exibido ao lado.
|
| 25 |
+
|
| 26 |
+
## Manual
|
| 27 |
+
|
| 28 |
+
O manual completo pode ser acessado e baixado clicando no [Manual do PseudocodeLab](https://huggingface.co/spaces/rmayormartins/pseudocodelab/blob/main/Manual_PseudocodeLab.pdf).
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
## A fazer
|
| 32 |
+
|
| 33 |
+
- Verificação de erros
|
| 34 |
+
- Tradução para espanhol e inglês
|
| 35 |
+
- Adicionar outras funções
|
| 36 |
+
|
| 37 |
+
## Informação adicional
|
| 38 |
+
|
| 39 |
+
- Desenvolvido por Ramon Mayor Martins, Ph.D. (2024)
|
| 40 |
+
- E-mail: rmayormartins at: gmail.com
|
| 41 |
+
- Pessoal: [https://rmayormartins.github.io/](https://rmayormartins.github.io/)
|
| 42 |
+
- GitHub: [https://github.com/rmayormartins](https://github.com/rmayormartins)
|
| 43 |
+
|
| 44 |
+
## Agradecimento especial
|
| 45 |
+
|
| 46 |
+
Instituto Federal de Santa Catarina, Câmpus São José, Área de Telecomunicações [https://ifsc.edu.br/](https://ifsc.edu.br/)
|
app.py
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import io
|
| 3 |
+
import contextlib
|
| 4 |
+
import re
|
| 5 |
+
import traceback
|
| 6 |
+
import math
|
| 7 |
+
|
| 8 |
+
# Funções auxiliares
|
| 9 |
+
def preprocessar_codigos(portugol_code):
|
| 10 |
+
replacements = {
|
| 11 |
+
r"\bSENAO\b": "ELSE",
|
| 12 |
+
r"\bFIMSE\b": "ENDIF",
|
| 13 |
+
r"\bENTAO\b": "THEN",
|
| 14 |
+
r"\bRAIZ\(": "math.sqrt(",
|
| 15 |
+
r"(\w+)\^(\w+)": r"math.pow(\1, \2)",
|
| 16 |
+
r"\bE\b": "and",
|
| 17 |
+
r"\bOU\b": "or",
|
| 18 |
+
r"\bNAO\b": "not",
|
| 19 |
+
r"\bESCOLHA\b": "SWITCH",
|
| 20 |
+
r"\bCASO\b": "CASE",
|
| 21 |
+
r"\bCASO CONTRARIO\b": "DEFAULT",
|
| 22 |
+
r"\bFIM-ESCOLHA\b": "ENDSWITCH",
|
| 23 |
+
r"\bPARA\b": "FOR",
|
| 24 |
+
r"\bATÉ\b": "TO",
|
| 25 |
+
r"\bATE\b": "TO",
|
| 26 |
+
r"\bFIM-PARA\b": "ENDFOR",
|
| 27 |
+
r"\bESCREVER\b": "ESCREVA",
|
| 28 |
+
r"\bENQUANTO\b": "WHILE",
|
| 29 |
+
r"\bFIM-ENQUANTO\b": "ENDWHILE"
|
| 30 |
+
}
|
| 31 |
+
for pattern, replacement in replacements.items():
|
| 32 |
+
portugol_code = re.sub(pattern, replacement, portugol_code, flags=re.IGNORECASE)
|
| 33 |
+
return portugol_code
|
| 34 |
+
|
| 35 |
+
def processar_escreva(linha):
|
| 36 |
+
padrao = r'ESCREVA\s*(.*)'
|
| 37 |
+
match = re.match(padrao, linha, re.IGNORECASE)
|
| 38 |
+
if match:
|
| 39 |
+
conteudo = match.group(1).strip()
|
| 40 |
+
conteudo_parts = conteudo.split('//', 1)
|
| 41 |
+
conteudo = conteudo_parts[0].strip()
|
| 42 |
+
comentario = f" # {conteudo_parts[1].strip()}" if len(conteudo_parts) > 1 else ""
|
| 43 |
+
if conteudo.startswith('"') and conteudo.endswith('"'):
|
| 44 |
+
return f"print({conteudo}){comentario}"
|
| 45 |
+
else:
|
| 46 |
+
return f"print({conteudo}){comentario}"
|
| 47 |
+
return linha
|
| 48 |
+
|
| 49 |
+
def verificar_tipo(var_name, valor, tipos_variaveis, linha):
|
| 50 |
+
if var_name in tipos_variaveis:
|
| 51 |
+
tipo_declarado = tipos_variaveis[var_name]
|
| 52 |
+
if tipo_declarado == "INTEIRO" and "/" in valor:
|
| 53 |
+
return f"# Atenção: Possível atribuição de valor real à variável inteira '{var_name}' na linha: {linha}"
|
| 54 |
+
return None
|
| 55 |
+
|
| 56 |
+
def traduzir_para_python(portugol_code):
|
| 57 |
+
portugol_code = preprocessar_codigos(portugol_code)
|
| 58 |
+
lines = portugol_code.splitlines()
|
| 59 |
+
codigo_python = ["import math"]
|
| 60 |
+
indentacao = 0
|
| 61 |
+
contexto_bloco = []
|
| 62 |
+
tipos_variaveis = {}
|
| 63 |
+
avisos = []
|
| 64 |
+
in_variaveis = False
|
| 65 |
+
in_algoritmo = False
|
| 66 |
+
algoritmo_iniciado = False
|
| 67 |
+
|
| 68 |
+
for i, line in enumerate(lines, 1):
|
| 69 |
+
original_line = line
|
| 70 |
+
line = line.strip()
|
| 71 |
+
|
| 72 |
+
line_parts = line.split('//', 1)
|
| 73 |
+
line = line_parts[0].strip()
|
| 74 |
+
comentario = f" # {line_parts[1].strip()}" if len(line_parts) > 1 else ""
|
| 75 |
+
|
| 76 |
+
if not line and comentario:
|
| 77 |
+
codigo_python.append(f"{' ' * indentacao}{comentario.strip()}")
|
| 78 |
+
continue
|
| 79 |
+
|
| 80 |
+
if line.upper().startswith("ALGORITMO"):
|
| 81 |
+
in_algoritmo = True
|
| 82 |
+
algoritmo_iniciado = True
|
| 83 |
+
continue
|
| 84 |
+
if line.upper() in ["VARIAVEIS", "VARIAVEL"]:
|
| 85 |
+
in_variaveis = True
|
| 86 |
+
algoritmo_iniciado = True
|
| 87 |
+
continue
|
| 88 |
+
if line.upper() == "INICIO":
|
| 89 |
+
in_variaveis = False
|
| 90 |
+
in_algoritmo = False
|
| 91 |
+
algoritmo_iniciado = True
|
| 92 |
+
continue
|
| 93 |
+
if line.upper() == "FIM":
|
| 94 |
+
break
|
| 95 |
+
|
| 96 |
+
if not algoritmo_iniciado and line:
|
| 97 |
+
in_variaveis = False
|
| 98 |
+
in_algoritmo = False
|
| 99 |
+
algoritmo_iniciado = True
|
| 100 |
+
|
| 101 |
+
if in_variaveis or (not algoritmo_iniciado and (":" in line or "=" in line)):
|
| 102 |
+
if ":" in line:
|
| 103 |
+
parts = line.split(":", 1)
|
| 104 |
+
var_name = parts[0].strip()
|
| 105 |
+
var_type_and_value = parts[1].strip()
|
| 106 |
+
|
| 107 |
+
if "=" in var_type_and_value:
|
| 108 |
+
var_type, var_value = var_type_and_value.split("=", 1)
|
| 109 |
+
var_type = var_type.strip().upper()
|
| 110 |
+
var_value = var_value.strip()
|
| 111 |
+
else:
|
| 112 |
+
var_type = var_type_and_value.upper()
|
| 113 |
+
var_value = None
|
| 114 |
+
|
| 115 |
+
tipos_variaveis[var_name] = var_type
|
| 116 |
+
|
| 117 |
+
if var_value:
|
| 118 |
+
codigo_python.append(f"{var_name} = {var_value}")
|
| 119 |
+
else:
|
| 120 |
+
if var_type == "INTEIRO":
|
| 121 |
+
codigo_python.append(f"{var_name} = 0")
|
| 122 |
+
elif var_type == "REAL":
|
| 123 |
+
codigo_python.append(f"{var_name} = 0.0")
|
| 124 |
+
elif var_type == "LOGICO":
|
| 125 |
+
codigo_python.append(f"{var_name} = False")
|
| 126 |
+
elif var_type == "STRING":
|
| 127 |
+
codigo_python.append(f"{var_name} = ''")
|
| 128 |
+
elif var_type == "CARACTERE":
|
| 129 |
+
codigo_python.append(f"{var_name} = ''")
|
| 130 |
+
elif "=" in line:
|
| 131 |
+
var_name, valor = line.split("=", 1)
|
| 132 |
+
var_name = var_name.strip()
|
| 133 |
+
valor = valor.strip()
|
| 134 |
+
codigo_python.append(f"{var_name} = {valor}")
|
| 135 |
+
continue
|
| 136 |
+
|
| 137 |
+
if not in_algoritmo:
|
| 138 |
+
if line.upper().startswith("LEIA"):
|
| 139 |
+
var_name = line.split("(")[1].split(")")[0].strip()
|
| 140 |
+
if var_name in tipos_variaveis:
|
| 141 |
+
tipo = tipos_variaveis[var_name]
|
| 142 |
+
if tipo == "INTEIRO":
|
| 143 |
+
codigo_python.append(f"{var_name} = int(input('Digite um valor para {var_name}: '))")
|
| 144 |
+
elif tipo == "REAL":
|
| 145 |
+
codigo_python.append(f"{var_name} = float(input('Digite um valor para {var_name}: '))")
|
| 146 |
+
elif tipo == "STRING":
|
| 147 |
+
codigo_python.append(f"{var_name} = input('Digite um valor para {var_name}: ')")
|
| 148 |
+
elif tipo == "CARACTERE":
|
| 149 |
+
codigo_python.append(f"_temp_{var_name} = input('Digite um valor para {var_name}: ')")
|
| 150 |
+
codigo_python.append(f"if len(_temp_{var_name}) != 1:")
|
| 151 |
+
codigo_python.append(f" print('Atenção: Esperava-se um único caractere para {var_name}. Usando apenas o primeiro caractere.')")
|
| 152 |
+
codigo_python.append(f"{var_name} = _temp_{var_name}[0] if _temp_{var_name} else ''")
|
| 153 |
+
else:
|
| 154 |
+
codigo_python.append(f"{var_name} = input('Digite um valor para {var_name}: ')")
|
| 155 |
+
else:
|
| 156 |
+
codigo_python.append(f"{var_name} = input('Digite um valor para {var_name}: ')")
|
| 157 |
+
|
| 158 |
+
elif line.upper().startswith("SE"):
|
| 159 |
+
condicao = line[2:].split("THEN")[0].strip()
|
| 160 |
+
codigo_python.append(f"{' ' * indentacao}if {condicao}:")
|
| 161 |
+
contexto_bloco.append("if")
|
| 162 |
+
indentacao += 1
|
| 163 |
+
|
| 164 |
+
elif line.upper() == "ELSE":
|
| 165 |
+
if contexto_bloco and contexto_bloco[-1] == "if":
|
| 166 |
+
indentacao -= 1
|
| 167 |
+
codigo_python.append(f"{' ' * indentacao}else:")
|
| 168 |
+
indentacao += 1
|
| 169 |
+
else:
|
| 170 |
+
codigo_python.append(f"# Aviso: 'ELSE' sem 'SE' correspondente: {line}")
|
| 171 |
+
|
| 172 |
+
elif line.upper() == "ENDIF":
|
| 173 |
+
if contexto_bloco and contexto_bloco[-1] in ["if", "else"]:
|
| 174 |
+
indentacao -= 1
|
| 175 |
+
contexto_bloco.pop()
|
| 176 |
+
else:
|
| 177 |
+
codigo_python.append(f"# Aviso: 'ENDIF' sem 'SE' correspondente: {line}")
|
| 178 |
+
|
| 179 |
+
elif line.upper().startswith("ESCREVA"):
|
| 180 |
+
codigo_python.append(f"{' ' * indentacao}{processar_escreva(line)}")
|
| 181 |
+
|
| 182 |
+
elif "=" in line:
|
| 183 |
+
var_name, valor = line.split("=", 1)
|
| 184 |
+
var_name = var_name.strip()
|
| 185 |
+
valor = valor.strip()
|
| 186 |
+
aviso = verificar_tipo(var_name, valor, tipos_variaveis, i)
|
| 187 |
+
if aviso:
|
| 188 |
+
avisos.append(aviso)
|
| 189 |
+
codigo_python.append(f"{' ' * indentacao}{line}{comentario}")
|
| 190 |
+
|
| 191 |
+
else:
|
| 192 |
+
codigo_python.append(f"{' ' * indentacao}{line}{comentario}")
|
| 193 |
+
|
| 194 |
+
return "\n".join(codigo_python), avisos
|
| 195 |
+
|
| 196 |
+
# Função para interpretar o pseudocódigo
|
| 197 |
+
def interpretador(portugol_code):
|
| 198 |
+
codigo_python = "# Código Python não gerado devido a um erro"
|
| 199 |
+
try:
|
| 200 |
+
codigo_python, avisos = traduzir_para_python(portugol_code)
|
| 201 |
+
codigo_python = re.sub(r"\bAND\b", "and", codigo_python)
|
| 202 |
+
|
| 203 |
+
output = io.StringIO()
|
| 204 |
+
with contextlib.redirect_stdout(output):
|
| 205 |
+
exec(codigo_python, globals())
|
| 206 |
+
|
| 207 |
+
resultado = ""
|
| 208 |
+
if avisos:
|
| 209 |
+
resultado += "Avisos:\n" + "\n".join(avisos) + "\n\n"
|
| 210 |
+
resultado += f"Saída:\n{output.getvalue().strip()}"
|
| 211 |
+
return resultado
|
| 212 |
+
except Exception as e:
|
| 213 |
+
error_traceback = traceback.format_exc()
|
| 214 |
+
return f"Erro durante a execução:\n{error_traceback}\n\nCódigo Python Gerado:\n{codigo_python}"
|
| 215 |
+
|
| 216 |
+
def interpretar(portugol_code):
|
| 217 |
+
return interpretador(portugol_code)
|
| 218 |
+
|
| 219 |
+
# Interface Gradio
|
| 220 |
+
description_html = """
|
| 221 |
+
<p>PseudocodeLab - Interpretador de Pseudocódigo</p>
|
| 222 |
+
<p>Ramon Mayor Martins: <a href="https://rmayormartins.github.io/" target="_blank">Website</a> | <a href="https://huggingface.co/rmayormartins" target="_blank">Spaces</a></p>
|
| 223 |
+
<p><a href="Manual_PseudocodeLab.pdf" download>Clique aqui para baixar o Manual do PseudocodeLab</a></p>
|
| 224 |
+
"""
|
| 225 |
+
|
| 226 |
+
# Criação da interface Gradio
|
| 227 |
+
iface = gr.Interface(
|
| 228 |
+
fn=interpretar,
|
| 229 |
+
inputs=gr.Textbox(lines=20, label="Código Portugol"),
|
| 230 |
+
outputs="text",
|
| 231 |
+
title="PseudocodeLab - Interpretador de Pseudocódigo",
|
| 232 |
+
description=description_html
|
| 233 |
+
)
|
| 234 |
+
|
| 235 |
+
# Lançamento da interface
|
| 236 |
+
if __name__ == "__main__":
|
| 237 |
+
iface.launch(debug=True)
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio==4.12.0
|
| 2 |
+
|
| 3 |
+
|