sudo-soldier commited on
Commit
c3f0e83
·
verified ·
1 Parent(s): c3b21a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -90,17 +90,19 @@ def gradio_app():
90
  rom_files = list_roms()
91
 
92
  # Display the available ROM files
93
- if rom_files:
94
- for rom_name in rom_files:
95
- # Create a button for each ROM
96
- gr.Button(rom_name).click(generate_rom_page, inputs=gr.State(rom_name), outputs=gr.HTML())
97
-
98
- # Display the ROM page inside a container with custom styling
99
  with gr.Column():
 
 
100
  output_html = gr.HTML(value="Please select a ROM to play.")
101
 
102
- # Apply the style using inline HTML
103
- output_html.value = '<div style="width: 100%; height: 500px; overflow: hidden;">' + output_html.value + '</div>'
 
 
 
 
 
 
104
 
105
  app.launch(server_name="0.0.0.0", server_port=7860, share=True)
106
 
@@ -115,3 +117,4 @@ gradio_app()
115
 
116
 
117
 
 
 
90
  rom_files = list_roms()
91
 
92
  # Display the available ROM files
 
 
 
 
 
 
93
  with gr.Column():
94
+ rom_buttons = gr.Dropdown(choices=rom_files, label="Select a ROM to Play", interactive=True)
95
+
96
  output_html = gr.HTML(value="Please select a ROM to play.")
97
 
98
+ # When a ROM is selected from the dropdown, update the HTML display with the ROM content
99
+ rom_buttons.change(fn=generate_rom_page, inputs=rom_buttons, outputs=output_html)
100
+
101
+ # Style for scrollable ROM list
102
+ rom_buttons.style(width="100%", height="300px", overflow="auto")
103
+
104
+ # Applying container style (for the video section)
105
+ output_html.style(width="100%", height=500)
106
 
107
  app.launch(server_name="0.0.0.0", server_port=7860, share=True)
108
 
 
117
 
118
 
119
 
120
+