kcoskun commited on
Commit
a2d4edf
·
verified ·
1 Parent(s): 5bb3f49

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -3
app.py CHANGED
@@ -244,7 +244,7 @@ def initial_html(P):
244
  )
245
  colorbar_html = generate_colorbar(colormap, normalize)
246
  combined_html = f"""
247
- <div style="display: flex; align-items: center; justify-content: center; gap: 50px;">
248
  <div>{state_diagram_html}</div>
249
  <div style="display: flex; justify-content: center; align-items: center; gap: 10px;">
250
  <div>{transition_matrix_html}</div>
@@ -293,7 +293,7 @@ def process_sequence(current_P, P_true_str, sequence_length, lambda_, tau, state
293
 
294
  # Combine matrix and colorbar HTML side-by-side in a flex container
295
  combined_html = f"""
296
- <div style="display: flex; align-items: center; justify-content: center; gap: 50px;">
297
  <div>{state_diagram_html}</div>
298
  <div style="display: flex; justify-content: center; align-items: center; gap: 10px;">
299
  <div>{transition_matrix_html}</div>
@@ -307,7 +307,22 @@ def process_sequence(current_P, P_true_str, sequence_length, lambda_, tau, state
307
 
308
  time.sleep(0.005) # Pause before the next state
309
 
310
- with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
 
312
  # initial probability distribution is a uniform distribution, saved in a State object
313
  P0 = 1/num_states * np.ones(shape=np.repeat(num_states, 2))
 
244
  )
245
  colorbar_html = generate_colorbar(colormap, normalize)
246
  combined_html = f"""
247
+ <div class="output_flexbox">
248
  <div>{state_diagram_html}</div>
249
  <div style="display: flex; justify-content: center; align-items: center; gap: 10px;">
250
  <div>{transition_matrix_html}</div>
 
293
 
294
  # Combine matrix and colorbar HTML side-by-side in a flex container
295
  combined_html = f"""
296
+ <div class="output_flexbox">
297
  <div>{state_diagram_html}</div>
298
  <div style="display: flex; justify-content: center; align-items: center; gap: 10px;">
299
  <div>{transition_matrix_html}</div>
 
307
 
308
  time.sleep(0.005) # Pause before the next state
309
 
310
+ css = """
311
+ .output_flexbox{
312
+ display: flex;
313
+ align-items: center;
314
+ justify-content:center;
315
+ gap: 50px;
316
+ flex-direction: row;
317
+ }
318
+ @media screen and (max-width: 800px){
319
+ .output_flexbox{
320
+ flex-direction: column;
321
+ }
322
+ }
323
+ """
324
+
325
+ with gr.Blocks(css=css) as demo:
326
 
327
  # initial probability distribution is a uniform distribution, saved in a State object
328
  P0 = 1/num_states * np.ones(shape=np.repeat(num_states, 2))