concauu commited on
Commit
d3399d2
·
verified ·
1 Parent(s): 9fa47ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -172,7 +172,12 @@ css = """
172
  max-width: 520px;
173
  }
174
  """
175
-
 
 
 
 
 
176
  # --- Gradio Interface ---
177
  with gr.Blocks(css="""
178
  .user-msg { background: #e3f2fd; border-radius: 15px; padding: 10px; margin: 5px; }
@@ -184,17 +189,14 @@ with gr.Blocks(css="""
184
  value="Medium",
185
  label="Font Size"
186
  )
 
 
187
  font_style = gr.HTML() # This will receive the injected CSS for font size
188
  font_choice.change(
189
  fn=get_font_size,
190
  inputs=font_choice,
191
- outputs=[], # no output component needed
192
- _js="""
193
- (fontSize) => {
194
- document.body.style.fontSize = fontSize;
195
- return "";
196
- }
197
- """
198
  )
199
 
200
  gr.Markdown("## Voice Input: Record your prompt")
 
172
  max-width: 520px;
173
  }
174
  """
175
+ js_callback = """
176
+ (fontSize) => {
177
+ document.body.style.fontSize = fontSize;
178
+ return "";
179
+ }
180
+ """
181
  # --- Gradio Interface ---
182
  with gr.Blocks(css="""
183
  .user-msg { background: #e3f2fd; border-radius: 15px; padding: 10px; margin: 5px; }
 
189
  value="Medium",
190
  label="Font Size"
191
  )
192
+ demo_markdown = gr.Markdown("### This text (and all other text) will change size dynamically.")
193
+ sample_text = gr.Textbox(label="Try typing here:", value="The quick brown fox jumps over the lazy dog.")
194
  font_style = gr.HTML() # This will receive the injected CSS for font size
195
  font_choice.change(
196
  fn=get_font_size,
197
  inputs=font_choice,
198
+ outputs=[], # No output component is updated by Python.
199
+ js=js_callback # This JS code runs on the client to update the page.
 
 
 
 
 
200
  )
201
 
202
  gr.Markdown("## Voice Input: Record your prompt")