elfgk commited on
Commit
7d8f7f9
·
verified ·
1 Parent(s): c9d4a47

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -1,20 +1,18 @@
1
  import pyqrcode
2
  import gradio as gr
 
3
 
4
  # QR kodu oluşturma fonksiyonu
5
-
6
  def qr_kodu_olustur(url):
7
  try:
8
  # QR kodunu oluştur
9
  qr_code = pyqrcode.create(url)
10
 
11
- # QR kodunu bir byte dizisine dönüştür
12
- byte_io = io.BytesIO()
13
- qr_code.png(byte_io, scale=5)
14
- byte_io.seek(0)
15
 
16
- # Görseli döndür
17
- image = Image.open(byte_io)
18
  return image
19
 
20
  except Exception as e:
@@ -24,9 +22,9 @@ def qr_kodu_olustur(url):
24
  arayuz = gr.Interface(
25
  fn=qr_kodu_olustur,
26
  inputs=gr.Textbox(label="URL Giriniz"),
27
- outputs=gr.Textbox(label="Sonuç"),
28
  title="QR Kodu Oluşturucu",
29
- description="URL girerek QR kodu oluşturabilirsiniz. QR kodu, 'qrcode.svg' dosyasına kaydedilecektir."
30
  )
31
 
32
  arayuz.launch()
 
1
  import pyqrcode
2
  import gradio as gr
3
+ from PIL import Image
4
 
5
  # QR kodu oluşturma fonksiyonu
 
6
  def qr_kodu_olustur(url):
7
  try:
8
  # QR kodunu oluştur
9
  qr_code = pyqrcode.create(url)
10
 
11
+ # QR kodunu dosyaya kaydet
12
+ qr_code.png('qrcode.png', scale=5)
 
 
13
 
14
+ # Görseli
15
+ image = Image.open('qrcode.png')
16
  return image
17
 
18
  except Exception as e:
 
22
  arayuz = gr.Interface(
23
  fn=qr_kodu_olustur,
24
  inputs=gr.Textbox(label="URL Giriniz"),
25
+ outputs=gr.Image(label="QR Kodu"),
26
  title="QR Kodu Oluşturucu",
27
+ description="URL girerek QR kodu oluşturabilirsiniz. QR kodu, görsel olarak aşağıda gösterilecektir."
28
  )
29
 
30
  arayuz.launch()