13ze commited on
Commit
98023a6
·
verified ·
1 Parent(s): fe999ec

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from PIL import Image
3
+ import io
4
+ import base64
5
+
6
+ # Função para converter base64 para imagem
7
+ def base64_to_image(base64_string):
8
+ # Decodifica a string base64
9
+ img_data = base64.b64decode(base64_string)
10
+ # Converte para imagem
11
+ image = Image.open(io.BytesIO(img_data))
12
+ return image
13
+
14
+ # Interface Gradio
15
+ iface = gr.Interface(
16
+ fn=base64_to_image,
17
+ inputs="text",
18
+ outputs="image",
19
+ live=True,
20
+ title="Base64 to JPG Converter",
21
+ description="Digite uma string base64 para converter em uma imagem JPG."
22
+ )
23
+
24
+ # Inicia a interface
25
+ iface.launch()