Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import random
|
| 3 |
+
|
| 4 |
+
def simulate_edge(device_type, ai_model, edge_location):
|
| 5 |
+
latency = round(random.uniform(2, 25), 1)
|
| 6 |
+
accuracy = round(random.uniform(88, 99), 1)
|
| 7 |
+
power = round(random.uniform(2, 12), 1)
|
| 8 |
+
throughput = random.randint(15, 120)
|
| 9 |
+
|
| 10 |
+
result = f"""### AIoT Edge Simulation Results
|
| 11 |
+
|
| 12 |
+
**Device Type**: {device_type}
|
| 13 |
+
**AI Model**: {ai_model}
|
| 14 |
+
**Edge Location**: {edge_location}
|
| 15 |
+
|
| 16 |
+
🎮 **Simulation Metrics**:
|
| 17 |
+
- Inference Latency: {latency}ms
|
| 18 |
+
- Model Accuracy: {accuracy}%
|
| 19 |
+
- Power Consumption: {power}W
|
| 20 |
+
- Throughput: {throughput} inferences/sec
|
| 21 |
+
- Edge Processing: {'Enabled' if random.choice([True, False]) else 'Cloud Fallback'}
|
| 22 |
+
|
| 23 |
+
**Status**: ✅ Simulation completed successfully
|
| 24 |
+
|
| 25 |
+
---
|
| 26 |
+
**Anktechsol** - AIoT & Edge AI Solutions
|
| 27 |
+
🔗 [Visit anktechsol.com](https://anktechsol.com)"""
|
| 28 |
+
return result
|
| 29 |
+
|
| 30 |
+
with gr.Blocks(title="AIoT Edge Simulator") as demo:
|
| 31 |
+
gr.Markdown("# 🌐 AIoT & Edge AI Simulator")
|
| 32 |
+
gr.Markdown("Test AIoT deployments - **Anktechsol**")
|
| 33 |
+
|
| 34 |
+
with gr.Row():
|
| 35 |
+
with gr.Column():
|
| 36 |
+
device = gr.Dropdown(["Raspberry Pi 4", "Jetson Nano", "AWS IoT Greengrass", "Azure IoT Edge"], label="Edge Device", value="Raspberry Pi 4")
|
| 37 |
+
model = gr.Dropdown(["Object Detection", "Image Classification", "Anomaly Detection", "Predictive Model"], label="AI Model", value="Object Detection")
|
| 38 |
+
location = gr.Radio(["Factory Floor", "Warehouse", "Retail Store", "Remote Site"], label="Deployment Location", value="Factory Floor")
|
| 39 |
+
btn = gr.Button("Run Simulation")
|
| 40 |
+
|
| 41 |
+
with gr.Column():
|
| 42 |
+
output = gr.Markdown()
|
| 43 |
+
|
| 44 |
+
btn.click(simulate_edge, inputs=[device, model, location], outputs=output)
|
| 45 |
+
|
| 46 |
+
gr.Markdown("""---
|
| 47 |
+
### Anktechsol - AIoT Specialists
|
| 48 |
+
Edge AI deployment & AIoT consulting. [Get started](https://anktechsol.com)""")
|
| 49 |
+
|
| 50 |
+
demo.launch()
|