CultriX commited on
Commit
7df5306
·
verified ·
1 Parent(s): 9df5c86

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -15
app.py CHANGED
@@ -86,10 +86,6 @@ def create_gradio_interface():
86
  description="Quickly create a QR code from any text or URL.",
87
  )
88
 
89
- # Add download button to generated QR code
90
- download_button = gr.Button("Download QR Code")
91
- download_button.click(fn=lambda x: download_qr_code(x), inputs="Generated QR Code", outputs=None)
92
-
93
  # QR Code Reader Interface
94
  read_interface = gr.Interface(
95
  fn=read_qr_code,
@@ -99,20 +95,17 @@ def create_gradio_interface():
99
  description="Upload an image with a QR code to decode the embedded data.",
100
  )
101
 
102
- # Add copy to clipboard button to decoded text
103
- copy_button = gr.Button("Copy to Clipboard")
104
- copy_button.click(fn=lambda x: copy_to_clipboard(x), inputs="Decoded Data", outputs=None)
105
-
106
  # Combine interfaces into a single tabbed layout
107
- interface = gr.TabbedInterface(
108
- [generate_interface, read_interface],
109
- ["Generate QR Code", "Read QR Code"]
110
- )
111
-
112
- # Launch interface with custom HTML for CSS styling
113
  with gr.Blocks() as demo:
114
  gr.HTML(custom_css) # Embed the custom CSS
115
- interface.render()
 
 
 
 
 
 
 
116
 
117
  demo.launch(share=True)
118
 
 
86
  description="Quickly create a QR code from any text or URL.",
87
  )
88
 
 
 
 
 
89
  # QR Code Reader Interface
90
  read_interface = gr.Interface(
91
  fn=read_qr_code,
 
95
  description="Upload an image with a QR code to decode the embedded data.",
96
  )
97
 
 
 
 
 
98
  # Combine interfaces into a single tabbed layout
 
 
 
 
 
 
99
  with gr.Blocks() as demo:
100
  gr.HTML(custom_css) # Embed the custom CSS
101
+ with gr.Tab("Generate QR Code"):
102
+ generate_interface.render()
103
+ download_button = gr.Button("Download QR Code")
104
+ download_button.click(fn=lambda x: download_qr_code(x), inputs="Generated QR Code", outputs=None)
105
+ with gr.Tab("Read QR Code"):
106
+ read_interface.render()
107
+ copy_button = gr.Button("Copy to Clipboard")
108
+ copy_button.click(fn=lambda x: copy_to_clipboard(x), inputs="Decoded Data", outputs=None)
109
 
110
  demo.launch(share=True)
111