rmayormartins commited on
Commit
7f09351
1 Parent(s): 28001bd

Subindo arquivos

Browse files
Files changed (3) hide show
  1. README.md +29 -0
  2. app.py +34 -0
  3. requirements.txt +4 -0
README.md CHANGED
@@ -1,4 +1,32 @@
1
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  title: Conversordpi
3
  emoji: 🏢
4
  colorFrom: green
@@ -11,3 +39,4 @@ license: ecl-2.0
11
  ---
12
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ <<<<<<< HEAD
3
+ title: conversordpi
4
+ emoji: 🖼️
5
+ colorFrom: blue
6
+ colorTo: green
7
+ sdk: gradio
8
+ sdk_version: "4.12.0"
9
+ app_file: app.py
10
+ pinned: false
11
+ ---
12
+
13
+
14
+ # Conversor DPI
15
+
16
+ Faça o upload da imagem, ajuste o dpi e submeta
17
+
18
+ ## Versao teste 1 (25/04)
19
+
20
+ - Ramon Mayor Martins
21
+ - E-mail: [rmayormartins@gmail.com](mailto:rmayormartins@gmail.com)
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+ =======
30
  title: Conversordpi
31
  emoji: 🏢
32
  colorFrom: green
 
39
  ---
40
 
41
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
42
+ >>>>>>> 28001bd6dabdd9ade761a2b36de32e1f8cf53371
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from PIL import Image
3
+ import io
4
+ import numpy as np
5
+ import tempfile
6
+
7
+ def muda_dpi(input_image, dpi):
8
+ dpi_tuple = (dpi, dpi)
9
+
10
+ image = Image.fromarray(input_image.astype('uint8'), 'RGB')
11
+
12
+
13
+ temp_file = tempfile.NamedTemporaryFile(delete=False, suffix='.png')
14
+ image.save(temp_file, format='PNG', dpi=dpi_tuple)
15
+ temp_file.close()
16
+
17
+
18
+ return temp_file.name
19
+
20
+
21
+ iface = gr.Interface(
22
+ fn=muda_dpi,
23
+ inputs=[
24
+ gr.Image(label="Upload"),
25
+ gr.Number(label="Ajusta DPI", value=300)
26
+ ],
27
+ outputs=gr.File(label="Download"),
28
+ title="Conversor DPI",
29
+ description="Faça o upload da imagem (.jpg, .png), ajuste o DPI e submeta"
30
+ )
31
+
32
+
33
+ iface.launch(debug=True)
34
+
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ gradio
2
+ Pillow
3
+ numpy
4
+