Taizun commited on
Commit
919a251
·
verified ·
1 Parent(s): be21c0d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -16
app.py CHANGED
@@ -81,20 +81,22 @@ ga_script = """
81
  </script>
82
  """
83
 
84
- # Define the Gradio interface
85
- demo = gr.Interface(
86
- fn=detect_object,
87
- inputs=gr.Image(label="Upload an Image", type="pil"),
88
- outputs=[
89
- gr.Image(label="Processed Image", type="pil"),
90
- gr.Audio(label="Generated Audio")
91
- ],
92
- title="Multi-Object Detection with Audio Narration",
93
- description=description_text,
94
- )
95
-
96
- # Add the Google Analytics script to the Gradio interface
97
- demo.add_component(gr.HTML(ga_script))
98
-
99
- # Launch the interface
 
100
  demo.launch()
 
 
81
  </script>
82
  """
83
 
84
+ # Use Gradio Blocks to organize the layout
85
+ with gr.Blocks() as demo:
86
+ gr.HTML(ga_script) # Injecting Google Analytics script
87
+ gr.Markdown(description_text) # Adding the description as Markdown
88
+
89
+ # Define the Interface components within Blocks
90
+ gr.Interface(
91
+ fn=detect_object,
92
+ inputs=gr.Image(label="Upload an Image", type="pil"),
93
+ outputs=[
94
+ gr.Image(label="Processed Image", type="pil"),
95
+ gr.Audio(label="Generated Audio")
96
+ ],
97
+ title="Multi-Object Detection with Audio Narration",
98
+ )
99
+
100
+ # Launch the Blocks interface
101
  demo.launch()
102
+