Sadjad Alikhani commited on
Commit
ca32c10
·
verified ·
1 Parent(s): db6c19e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -20
app.py CHANGED
@@ -27,6 +27,16 @@ def display_images(percentage_idx, complexity_idx):
27
  # Return the loaded images
28
  return raw_image, embeddings_image
29
 
 
 
 
 
 
 
 
 
 
 
30
  # Define the Gradio interface
31
  with gr.Blocks(css="""
32
  .vertical-slider input[type=range] {
@@ -41,29 +51,47 @@ with gr.Blocks(css="""
41
  text-align: center;
42
  }
43
  """) as demo:
44
- gr.Markdown("# Raw vs. Embeddings Inference Results")
45
- gr.Markdown("Use the sliders to adjust the percentage of data for training and task complexity.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
- # Layout for vertical side-by-side sliders (using CSS to rotate sliders)
48
- with gr.Row():
49
- # Column for percentage slider
50
- with gr.Column(elem_id="slider-container"):
51
- gr.Markdown("Percentage of Data for Training")
52
- percentage_slider = gr.Slider(minimum=0, maximum=4, step=1, value=0, interactive=True, elem_id="vertical-slider")
53
 
54
- # Column for complexity slider
55
- with gr.Column(elem_id="slider-container"):
56
- gr.Markdown("Task Complexity")
57
- complexity_slider = gr.Slider(minimum=0, maximum=1, step=1, value=0, interactive=True, elem_id="vertical-slider")
58
 
59
- # Outputs (display the images side by side and set a smaller size for the images)
60
- with gr.Row():
61
- raw_img = gr.Image(label="Raw Channels", type="pil", width=300, height=300, interactive=False) # Smaller image size
62
- embeddings_img = gr.Image(label="Embeddings", type="pil", width=300, height=300, interactive=False) # Smaller image size
63
-
64
- # Trigger image updates when sliders change
65
- percentage_slider.change(fn=display_images, inputs=[percentage_slider, complexity_slider], outputs=[raw_img, embeddings_img])
66
- complexity_slider.change(fn=display_images, inputs=[percentage_slider, complexity_slider], outputs=[raw_img, embeddings_img])
67
 
68
  # Launch the app
69
  if __name__ == "__main__":
 
27
  # Return the loaded images
28
  return raw_image, embeddings_image
29
 
30
+ # Define the beam prediction function
31
+ def beam_prediction(input_data):
32
+ # Add your beam prediction logic here
33
+ return {"Prediction": "Beam X", "Confidence": "95%"}
34
+
35
+ # Define the LoS/NLoS classification function
36
+ def los_nlos_classification(input_data):
37
+ # Add your LoS/NLoS classification logic here
38
+ return {"Classification": "LoS", "Confidence": "98%"}
39
+
40
  # Define the Gradio interface
41
  with gr.Blocks(css="""
42
  .vertical-slider input[type=range] {
 
51
  text-align: center;
52
  }
53
  """) as demo:
54
+
55
+ gr.Markdown("# Wireless Model Tasks")
56
+
57
+ # Tabs for Beam Prediction and LoS/NLoS Classification
58
+ with gr.Tab("Beam Prediction Task"):
59
+ gr.Markdown("### Beam Prediction Task")
60
+ beam_input = gr.Textbox(label="Enter Input Data for Beam Prediction", placeholder="Enter data here...")
61
+ beam_button = gr.Button("Predict Beam")
62
+ beam_output = gr.JSON(label="Beam Prediction Result")
63
+ beam_button.click(beam_prediction, inputs=beam_input, outputs=beam_output)
64
+
65
+ with gr.Tab("LoS/NLoS Classification Task"):
66
+ gr.Markdown("### LoS/NLoS Classification Task")
67
+ los_input = gr.Textbox(label="Enter Input Data for LoS/NLoS Classification", placeholder="Enter data here...")
68
+ los_button = gr.Button("Classify")
69
+ los_output = gr.JSON(label="LoS/NLoS Classification Result")
70
+ los_button.click(los_nlos_classification, inputs=los_input, outputs=los_output)
71
+
72
+ with gr.Tab("Raw vs. Embeddings Inference Results"):
73
+ gr.Markdown("Use the sliders to adjust the percentage of data for training and task complexity.")
74
 
75
+ # Layout for vertical side-by-side sliders (using CSS to rotate sliders)
76
+ with gr.Row():
77
+ # Column for percentage slider
78
+ with gr.Column(elem_id="slider-container"):
79
+ gr.Markdown("Percentage of Data for Training")
80
+ percentage_slider = gr.Slider(minimum=0, maximum=4, step=1, value=0, interactive=True, elem_id="vertical-slider")
81
 
82
+ # Column for complexity slider
83
+ with gr.Column(elem_id="slider-container"):
84
+ gr.Markdown("Task Complexity")
85
+ complexity_slider = gr.Slider(minimum=0, maximum=1, step=1, value=0, interactive=True, elem_id="vertical-slider")
86
 
87
+ # Outputs (display the images side by side and set a smaller size for the images)
88
+ with gr.Row():
89
+ raw_img = gr.Image(label="Raw Channels", type="pil", width=300, height=300, interactive=False) # Smaller image size
90
+ embeddings_img = gr.Image(label="Embeddings", type="pil", width=300, height=300, interactive=False) # Smaller image size
91
+
92
+ # Trigger image updates when sliders change
93
+ percentage_slider.change(fn=display_images, inputs=[percentage_slider, complexity_slider], outputs=[raw_img, embeddings_img])
94
+ complexity_slider.change(fn=display_images, inputs=[percentage_slider, complexity_slider], outputs=[raw_img, embeddings_img])
95
 
96
  # Launch the app
97
  if __name__ == "__main__":