mariusjabami commited on
Commit
2a9725f
·
verified ·
1 Parent(s): 0489d03

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +536 -69
app.py CHANGED
@@ -1,70 +1,537 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
- from huggingface_hub import InferenceClient
3
-
4
-
5
- def respond(
6
- message,
7
- history: list[dict[str, str]],
8
- system_message,
9
- max_tokens,
10
- temperature,
11
- top_p,
12
- hf_token: gr.OAuthToken,
13
- ):
14
- """
15
- For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
16
- """
17
- client = InferenceClient(token=hf_token.token, model="openai/gpt-oss-20b")
18
-
19
- messages = [{"role": "system", "content": system_message}]
20
-
21
- messages.extend(history)
22
-
23
- messages.append({"role": "user", "content": message})
24
-
25
- response = ""
26
-
27
- for message in client.chat_completion(
28
- messages,
29
- max_tokens=max_tokens,
30
- stream=True,
31
- temperature=temperature,
32
- top_p=top_p,
33
- ):
34
- choices = message.choices
35
- token = ""
36
- if len(choices) and choices[0].delta.content:
37
- token = choices[0].delta.content
38
-
39
- response += token
40
- yield response
41
-
42
-
43
- """
44
- For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
45
- """
46
- chatbot = gr.ChatInterface(
47
- respond,
48
- type="messages",
49
- additional_inputs=[
50
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
51
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
52
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
53
- gr.Slider(
54
- minimum=0.1,
55
- maximum=1.0,
56
- value=0.95,
57
- step=0.05,
58
- label="Top-p (nucleus sampling)",
59
- ),
60
- ],
61
- )
62
-
63
- with gr.Blocks() as demo:
64
- with gr.Sidebar():
65
- gr.LoginButton()
66
- chatbot.render()
67
-
68
-
69
- if __name__ == "__main__":
70
- demo.launch()
 
1
+ import os
2
+ from time import sleep
3
+ from dotenv import load_dotenv
4
+ from google import genai
5
+ from reportlab.platypus import Paragraph, Frame
6
+ from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
7
+ from reportlab.lib.pagesizes import A4
8
+ from reportlab.lib.utils import ImageReader
9
+ from reportlab.pdfgen import canvas
10
+
11
+ load_dotenv()
12
+ api_token = os.environ.get("SYNAP")
13
+
14
+
15
+ class Model():
16
+ def __init__(self, titulo_pdf, titulo, n_paginas):
17
+ self.titulo = titulo
18
+ self.n_paginas = n_paginas
19
+ self.oppo = genai.Client(api_key=api_token)
20
+ print(f"Escolhendo os Subtemas")
21
+ self.subtemas = self.API(f"Sobre o tema {titulo} cria no total {self.n_paginas} subtemas para um trabalho academico, e sempre começa com a introdução, e deixa nesse formato, Nome_do_subtema - tem que estar tudo junto separado por _, nomes curtos , apenas quero ver os temas, mais nenhuma outra resposta, tudo limpo so com os temas, nao pode ter espaco, tudo precisa estar ligado com _ ou -, mais nenhuma coisa, só os temas separados com _, por exemplo, Redes Neurais pode virar Redes_Neurais, separa com _ e não com -. Subtemas Curtos e devem vir bem escritos e acentuados e curtos").split()
22
+ sleep(5)
23
+ print(f"Subtemas Escolhidos!")
24
+
25
+ self.largura, self.altura = A4
26
+ self.c = canvas.Canvas(titulo_pdf, pagesize=A4)
27
+ self.pagina = 0
28
+ self.pagina_idc = 0
29
+
30
+ def capa(self, logo, capaImage, titulo, subtitulo, instituto):
31
+
32
+ self.logo = ImageReader(logo)
33
+ self.capaImage = ImageReader(capaImage)
34
+ self.titulo = titulo
35
+ self.instituto = instituto
36
+ self.professor = professor
37
+
38
+
39
+ x = (self.largura - 350)
40
+
41
+ y = self.altura - 150
42
+
43
+ self.c.drawImage(self.logo, x + 15, y, width=100, height=100)
44
+
45
+ self.c.setFont("Times-Roman", 10)
46
+ self.c.drawCentredString(x + 65, 675, "República de Angola")
47
+
48
+ self.c.setFont("Times-Roman", 10)
49
+ self.c.drawCentredString(x + 65, 660, "Ministério da Educação")
50
+
51
+ self.c.setFont("Times-Roman", 10)
52
+ self.c.drawCentredString(x + 65, 645, instituto)
53
+
54
+
55
+
56
+ self.c.setFont("Times-Bold", 35)
57
+ self.c.drawCentredString(x + 65, 580, titulo)
58
+
59
+ self.c.setFont("Times-Roman", 20)
60
+ self.c.drawCentredString(x + 65, 550, subtitulo)
61
+
62
+ self.c.drawImage(self.capaImage, (x - 65) / 2, (self.altura - 610), width=(576 + 270)/2, height=(315 + 200)/2)
63
+
64
+ margem = 20
65
+
66
+ self.c.rect(margem, margem, self.largura - 2*margem, self.altura - 2*margem)
67
+
68
+ self.c.setFont("Times-Roman", 15)
69
+ self.c.drawCentredString(x + 165, 150, "Docente")
70
+
71
+ self.c.line(320, 100, 490, 100)
72
+
73
+ def integrantes(self, integrantes, disciplina, grupo, classe, turma, curso, turno):
74
+
75
+ self.c.showPage()
76
+ self.paginar_letra("I")
77
+
78
+
79
+
80
+ y = 700
81
+ self.c.setFont("Times-Bold", 20)
82
+ self.c.drawCentredString(200, 750, "Integrantes do Grupo")
83
+ self.integrantes = integrantes
84
+
85
+ numero = 1
86
+ for i in integrantes:
87
+ self.c.setFont("Times-Roman", 15)
88
+ self.c.drawString(110, y, f"{numero}.")
89
+ self.c.drawString(130, y, f"{i}")
90
+
91
+ y -= 25
92
+ numero += 1
93
+
94
+
95
+ self.c.setFont("Times-Bold", 15)
96
+ self.c.drawString(110, 300, "Disciplina: ")
97
+ self.c.setFont("Times-Roman", 15)
98
+ self.c.drawString(190, 300, disciplina)
99
+
100
+ self.c.setFont("Times-Bold", 15)
101
+ self.c.drawString(110, 280, "Grupo: ")
102
+ self.c.setFont("Times-Roman", 15)
103
+ self.c.drawString(165, 280, grupo)
104
+
105
+ self.c.setFont("Times-Bold", 15)
106
+ self.c.drawString(110, 260, "Classe: ")
107
+ self.c.setFont("Times-Roman", 15)
108
+ self.c.drawString(165, 260, classe)
109
+
110
+ self.c.setFont("Times-Bold", 15)
111
+ self.c.drawString(110, 240, "Turma: ")
112
+ self.c.setFont("Times-Roman", 15)
113
+ self.c.drawString(165, 240, turma)
114
+
115
+ self.c.setFont("Times-Bold", 15)
116
+ self.c.drawString(110, 220, "Curso: ")
117
+ self.c.setFont("Times-Roman", 15)
118
+ self.c.drawString(165, 220, curso)
119
+
120
+ self.c.setFont("Times-Bold", 15)
121
+ self.c.drawString(110, 200, "Turno: ")
122
+ self.c.setFont("Times-Roman", 15)
123
+ self.c.drawString(165, 200, turno)
124
+
125
+ def agradecimentos(self, prof):
126
+
127
+ prompt = f"Cria uma nota de agradecimentos, imagina que um grupo escolara fez um trabalho academico e precisa fazer a parte dos agradecimentos, agradecer a Jesus Cristo e professor/a {prof}, OBS: a nota deve ser pequena, umas 4 linhas, não deve conter simbolos como ** ## ou outro, apenas texto puro, faz om agradecimento de forma geral, sem citar nós como alunos ou turma, apenas agradecendo"
128
+ print(f"Criando os Agradecimentos - Página {self.pagina}")
129
+ texto = self.API(prompt)
130
+ sleep(5)
131
+ self.c.showPage()
132
+ self.paginar_letra("II")
133
+
134
+ self.c.setFont("Times-Bold", 17)
135
+ self.c.drawCentredString(595/2, 750, "Agradecimentos")
136
+
137
+
138
+ styles = getSampleStyleSheet()
139
+ text = f"{texto}"
140
+
141
+ meust = ParagraphStyle(
142
+ "Marius",
143
+ parent=styles["Normal"],
144
+ fontName="Times-Roman",
145
+ fontSize=12,
146
+ alignment=4
147
+ )
148
+
149
+ frame = Frame(100, 100, 400, 630, showBoundary=0)
150
+
151
+ p = Paragraph(text, meust)
152
+ frame.addFromList([p], self.c)
153
+
154
+ def dedicatoria(self):
155
+
156
+ prompt = f"É um trabalho academico, cria uma dedicatoria pequena sobre a startup de criação de software CloseSource de Marius Jabami, uma nota meio pequena, umas 8 linhas, só quero a dedicatoria e mais nada, OBS: não usa simbolos como ** ou ##, podes usar tags html para negritar como <strong>"
157
+ print(f"Criando a Dedicatória - Página {self.pagina}")
158
+ texto = self.API(prompt)
159
+ sleep(5)
160
+ self.c.showPage()
161
+ self.paginar_letra("III")
162
+
163
+ self.c.setFont("Times-Bold", 17)
164
+ self.c.drawCentredString(595/2, 750, "Dedicatória")
165
+
166
+
167
+ styles = getSampleStyleSheet()
168
+ text = f"{texto}"
169
+
170
+ meust = ParagraphStyle(
171
+ "Marius",
172
+ parent=styles["Normal"],
173
+ fontName="Times-Roman",
174
+ fontSize=12,
175
+ alignment=4
176
+ )
177
+
178
+ frame = Frame(100, 100, 400, 630, showBoundary=0)
179
+
180
+ p = Paragraph(text, meust)
181
+ frame.addFromList([p], self.c)
182
+
183
+ def epigrafe(self):
184
+
185
+ prompt = "Manda uma frase famosa e aleatoria, com duplos sentidos, OBS: apenas quero a frase, mais nada escrito, interface totalmente limpa, nao usar simbolos como ** ##, apenas texto puro"
186
+ print(f"Criando a Epígrafe - Página {self.pagina}")
187
+ texto = self.API(prompt)
188
+ sleep(5)
189
+
190
+ self.c.showPage()
191
+ self.paginar_letra("IV")
192
+
193
+ self.c.setFont("Times-Bold", 17)
194
+ self.c.drawCentredString(595/2, 750, "Epígrafe")
195
+
196
+
197
+ styles = getSampleStyleSheet()
198
+ text = f'"{texto}"'
199
+
200
+ meust = ParagraphStyle(
201
+ "Marius",
202
+ parent=styles["Normal"],
203
+ fontName="Times-Italic",
204
+ fontSize=12,
205
+ alignment=2
206
+ )
207
+
208
+ frame = Frame(400, -350, 170, 630, showBoundary=0)
209
+
210
+ p = Paragraph(text, meust)
211
+ frame.addFromList([p], self.c)
212
+
213
+
214
+
215
+ def resumo(self):
216
+
217
+ prompt = f"Faz um resumo sobre o tema {self.titulo} em um trabalho academico, dizendo de forma geral o que o trabalho vai abordar OBS: nao usa simbolos como ** ou ##, quero apenas texto puro e apenas o resumo, sem nenhuma outra coisa, e usa <br/> usar dois para quebrar linha de preferência"
218
+ print(f"Criando o Resumo - Página {self.pagina}")
219
+ texto = self.API(prompt)
220
+ sleep(5)
221
+
222
+ self.c.showPage()
223
+ self.paginar_letra("V")
224
+
225
+ self.c.setFont("Times-Bold", 17)
226
+ self.c.drawCentredString(595/2, 750, "Resumo")
227
+
228
+
229
+ styles = getSampleStyleSheet()
230
+ text = f"{texto}"
231
+
232
+ meust = ParagraphStyle(
233
+ "Marius",
234
+ parent=styles["Normal"],
235
+ fontName="Times-Roman",
236
+ fontSize=12,
237
+ alignment=4
238
+ )
239
+
240
+ frame = Frame(100, 100, 400, 630, showBoundary=0)
241
+
242
+ p = Paragraph(text, meust)
243
+ frame.addFromList([p], self.c)
244
+
245
+ def indice(self):
246
+
247
+ print(f"Criando Índice - Página {self.pagina}")
248
+ self.c.showPage()
249
+ self.paginar_letra("VI")
250
+
251
+ y = 700
252
+ self.c.setFont("Times-Bold", 20)
253
+ self.c.drawCentredString(595/2, 750, "Índice")
254
+
255
+ temas = []
256
+ for i in self.subtemas:
257
+ temas.append(i.replace("_", " "))
258
+
259
+ x_inicial = 110
260
+ x_limite = 500
261
+
262
+ temas.append("Conclusão")
263
+ temas.append("Referências Bibliográficas")
264
+
265
+ for nome in temas:
266
+ self.pagina_idc +=1
267
+ self.c.setFont("Times-Roman", 15)
268
+
269
+ self.c.drawString(x_inicial, y, f"{nome} ")
270
+
271
+ largura_nome = self.c.stringWidth(nome, "Times-Roman", 15)
272
+ x_atual = x_inicial + largura_nome
273
+
274
+ largura_ponto = self.c.stringWidth(".", "Times-Roman", 15)
275
+
276
+ while x_atual + largura_ponto < x_limite:
277
+ self.c.drawString(x_atual, y, ".")
278
+ x_atual += largura_ponto
279
+
280
+ if nome == "Conclusão":
281
+ self.c.drawString(x_limite + 10, y, "I")
282
+ elif nome == "Referências Bibliográficas":
283
+ self.c.drawString(x_limite + 10, y, "II")
284
+ else:
285
+ self.c.drawString(x_limite + 10, y, str(self.pagina_idc))
286
+
287
+ y -= 25
288
+
289
+
290
+
291
+ def desenvolvimento(self):
292
+
293
+ sub = self.subtemas
294
+ sub.append("Conclusão")
295
+
296
+ temas = []
297
+
298
+
299
+ for t in sub:
300
+ temas.append(t.replace("_", " "))
301
+
302
+ for subtemas in temas:
303
+
304
+ prompt = f"""
305
+
306
+ Você é um assistente especializado em produzir DSENVOLVIMENTOS DE TEXTOS ACADÊMICOS claros, objetivos e bem estruturados.
307
+
308
+ INSTRUÇÕES OBRIGATÓRIAS:
309
+ - Tema principal: {self.titulo}
310
+ - Subtema a desenvolver: {subtemas}
311
+
312
+
313
+ FORMATO E ESTILO:
314
+ 1. A saída deve conter APENAS o texto do desenvolvimento. Não inclua títulos, cabeçalho, explicações, notas, listas, metadados ou qualquer tipo de marcação extra.
315
+ 2. Não utilize símbolos de Markdown (como **, ##, ###, ``` ou blocos de código). NÃO PRODUZA MARKDOWN.
316
+ 3. São permitidas apenas as seguintes tags HTML:
317
+ - `<br/>` para uma quebra curta de linha dentro de um parágrafo.
318
+ - `<br/><br/>` para separar parágrafos (OBRIGATÓRIO: cada novo parágrafo deve começar após exatamente `<br/><br/>`).
319
+ - `<strong>...</strong>` para negrito.
320
+ 4. Não utilize listas com “-”, “*”, “1.” ou similares; escreva em parágrafos contínuos.
321
+ 5. Não inclua citações, referências, URLs ou notas explicativas.
322
+ 6. Mantenha tom objetivo, técnico e adequado ao nível informado, evitando qualquer linguagem promocional.
323
+ 7. Não mistura paragrafos, eles devem ter no maximo 5 linhas, evita misturas, quebre linha sempre que poder
324
+ 8. Se o subtema for extenso nao tenha medo de desenvolver muito mais
325
+
326
+ CONTEÚDO:
327
+ - Apresente uma definição breve do subtema no contexto do tema principal.
328
+ - Desenvolva de 2 a 4 ideias centrais essenciais para compreender o subtema.
329
+ - Finalize com uma frase conclusiva que sintetize a relevância do subtema dentro do tema principal.
330
+
331
+ EXEMPLO DE FORMATO (não reproduzir no resultado):
332
+ Parágrafo 1...<br/><br/>Parágrafo 2 com <strong>termo importante</strong>...
333
+
334
+ ENTREGA:
335
+ - Responda somente com o desenvolvimento final.
336
+ - Não inclua linhas em branco extras no início ou no fim.
337
+ - Use `<br/><br/>` para separar parágrafos e `<strong>` apenas para destaque de termos essenciais.
338
+
339
+ DA O TEU MELHOR NA ORGANIZACAO, ORGANIZA MUITO BEM E SEM CONFUSÃO
340
+ Agora, seguindo rigorosamente todas as instruções acima, gere o resumo solicitado.
341
+
342
+ """
343
+
344
+ print(f"Criando o Subtema {subtemas} - Página {self.pagina + 1}")
345
+ texto = self.API(prompt)
346
+ print(f"Subtema {subtemas} criado!")
347
+ sleep(10)
348
+ self.pagina += 1
349
+ self.c.showPage()
350
+ if subtemas == "Conclusão":
351
+ self.paginar_letra("I")
352
+ else:
353
+ self.paginar(self.pagina)
354
+
355
+
356
+ self.c.setFont("Times-Bold", 17)
357
+ self.c.drawCentredString(595/2, 750, subtemas)
358
+
359
+ styles = getSampleStyleSheet()
360
+ text = f"{texto}"
361
+
362
+ meust = ParagraphStyle(
363
+ "Marius",
364
+ parent=styles["Normal"],
365
+ fontName="Times-Roman",
366
+ fontSize=12,
367
+ alignment=4
368
+ )
369
+
370
+ frame = Frame(100, 100, 400, 630, showBoundary=0)
371
+
372
+ p = Paragraph(text, meust)
373
+ frame.addFromList([p], self.c)
374
+
375
+
376
+
377
+ def ref(self):
378
+
379
+ prompt = f"""
380
+ Você é um assistente que gera REFERÊNCIAS BIBLIOGRÁFICAS em formato padronizado.
381
+
382
+ TEMA: {self.titulo}
383
+
384
+ INSTRUÇÕES OBRIGATÓRIAS:
385
+ 1. Gere EXATAMENTE 5 referências relacionadas ao tema informado.
386
+ 2. Cada referência deve conter EXATAMENTE 3 linhas:
387
+ - 1ª linha: Autor(es) e ano.
388
+ - 2ª linha: Título da obra/artigo.
389
+ - 3ª linha: Link em formato HTML, usando exclusivamente <u>...</u>.
390
+ 3. Cada referência deve ser separada da seguinte por exatamente `<br/><br/>`.
391
+ 4. Não usar listas, não usar markdown, não usar negrito ou itálico nas referências.
392
+ 5. Não adicionar explicações, textos extras ou comentários — apenas as referências no formato exigido.
393
+ 6. As referências podem ser fictícias, mas devem parecer verossímeis.
394
+
395
+ FORMATO EXEMPLO (NÃO reproduzir os dados abaixo):
396
+ Autor, Ano
397
+ Título da obra
398
+ <u>link...</u><br/><br/>
399
+
400
+ Agora gere as 5 referências conforme o tema.
401
+ """
402
+
403
+ print(f"Criando o Subtema Referências Bibliográficas - Página {self.pagina + 1}")
404
+ texto = self.API(prompt)
405
+ print(f" Trabalho finalizado criado!")
406
+ #sleep(7)
407
+
408
+ self.c.showPage()
409
+ self.pagina += 1
410
+ self.paginar_letra("II")
411
+
412
+ self.c.setFont("Times-Bold", 17)
413
+ self.c.drawCentredString(595/2, 750, "Referências Bibliográficas")
414
+
415
+ styles = getSampleStyleSheet()
416
+ text = f"{texto}"
417
+
418
+ meust = ParagraphStyle(
419
+ "Marius",
420
+ parent=styles["Normal"],
421
+ fontName="Times-Roman",
422
+ fontSize=12,
423
+ alignment=4
424
+ )
425
+
426
+ frame = Frame(100, 100, 400, 630, showBoundary=0)
427
+
428
+ p = Paragraph(text, meust)
429
+ frame.addFromList([p], self.c)
430
+
431
+
432
+
433
+
434
+ def paginar(self, pag):
435
+ self.c.drawString(500, 50, str(pag))
436
+
437
+ def paginar_letra(self, pag):
438
+ self.c.drawString(500, 50, pag)
439
+
440
+ def API(self, prompt):
441
+ res = self.oppo.models.generate_content(model="gemini-2.5-flash-lite", contents=prompt)
442
+ return res.text
443
+
444
+ def save(self):
445
+ self.c.save()
446
+
447
+
448
+ def criar_trabalho(logo, capaImage, titulo, subtitulo, instituto, integrantes, prof, disciplina, grupo, classe, turma, curso, turno, n_paginas):
449
+
450
+ txt = [t[0] for t in integrantes]
451
+ txt1 = []
452
+
453
+ for i in txt:
454
+ txt1.append(i)
455
+
456
+ nn = Model(f"{titulo}.pdf", titulo, n_paginas)
457
+ nn.capa(logo, capaImage, titulo, subtitulo, instituto)
458
+ nn.integrantes(txt, disciplina, grupo, classe, turma, curso, turno)
459
+ nn.agradecimentos(prof)
460
+ nn.dedicatoria()
461
+ nn.epigrafe()
462
+ nn.resumo()
463
+ nn.indice()
464
+ nn.desenvolvimento()
465
+ nn.ref()
466
+ nn.save()
467
+ return f"{titulo}.pdf"
468
+
469
+ logo = "logo.png"
470
+ titulo = "Alcoolismo em Angola"
471
+ inst = "Complexo Escolar Politécnico Girassol"
472
+ professor = "Hélder Vunge"
473
+ capa = "images.png"
474
+ sub = "Alto nível de alcoolismo em Angola"
475
+
476
+ #criar_trabalho(logo, capa, titulo, sub, inst)
477
+
478
+
479
+ import numpy as np
480
  import gradio as gr
481
+
482
+
483
+
484
+ with gr.Blocks(theme="NoCrypt/miku") as demo:
485
+
486
+ gr.Markdown("# PaperFlow - As tuas mãos invisíveis")
487
+ gr.Textbox(
488
+
489
+ label="ISSO PODE DEMORAR ~5MIN, MINHA CPU É RUINZINHA KKK",
490
+ value="DESENVOLVIDO PELA STARTUP CLOSESOURCE (CS)",
491
+ interactive=False
492
+ )
493
+
494
+
495
+ saida_do_pdf = gr.File(label="BAIXAR PDF")
496
+
497
+ with gr.Row():
498
+
499
+ logo = gr.Image(label="LOGO DO INSTITUTO OU ESCOLA", type="filepath")
500
+ capaImage = gr.Image(label="IMAGEM DA CAPA", type="filepath")
501
+
502
+ with gr.Row():
503
+ titulo = gr.Textbox(label="TÍTULO OU TEMA")
504
+ subtitulo = gr.Textbox(label="SUBTÍTULO")
505
+ instituto = gr.Textbox(label="INSTITUTO")
506
+
507
+ with gr.Row():
508
+
509
+ disciplina = gr.Textbox(label="DISCIPLINA")
510
+ grupo = gr.Textbox(label="GRUPO")
511
+ classe = gr.Textbox(label="CLASSE")
512
+ turma = gr.Textbox(label="TURMA")
513
+ curso = gr.Textbox(label="CURSO")
514
+ turno = gr.Textbox(label="TURNO")
515
+
516
+ with gr.Row():
517
+ professor = gr.Textbox(label="NOME DO PROFESSOR")
518
+ n_paginas = gr.Textbox(label="NÚMERO DE PÁGINAS (CONTEÚDO)")
519
+
520
+
521
+
522
+ integrantes = gr.DataFrame(
523
+
524
+ headers = ["Nome dos Integrantes"],
525
+ row_count=15,
526
+ col_count=1,
527
+ type="array",
528
+ interactive=True,
529
+ wrap=True
530
+
531
+ )
532
+
533
+ botao_criar = gr.Button("CRIAR TRABALHO")
534
+
535
+ botao_criar.click(fn=criar_trabalho, inputs=[logo, capaImage, titulo, subtitulo, instituto, integrantes, professor, disciplina, grupo, classe, turma, curso, turno, n_paginas], outputs=[saida_do_pdf])
536
+
537
+ demo.launch(share=True)