anktechsol's picture
Create app.py
2182139 verified
import gradio as gr
import random
def simulate_edge(device_type, ai_model, edge_location):
latency = round(random.uniform(2, 25), 1)
accuracy = round(random.uniform(88, 99), 1)
power = round(random.uniform(2, 12), 1)
throughput = random.randint(15, 120)
result = f"""### AIoT Edge Simulation Results
**Device Type**: {device_type}
**AI Model**: {ai_model}
**Edge Location**: {edge_location}
๐ŸŽฎ **Simulation Metrics**:
- Inference Latency: {latency}ms
- Model Accuracy: {accuracy}%
- Power Consumption: {power}W
- Throughput: {throughput} inferences/sec
- Edge Processing: {'Enabled' if random.choice([True, False]) else 'Cloud Fallback'}
**Status**: โœ… Simulation completed successfully
---
**Anktechsol** - AIoT & Edge AI Solutions
๐Ÿ”— [Visit anktechsol.com](https://anktechsol.com)"""
return result
with gr.Blocks(title="AIoT Edge Simulator") as demo:
gr.Markdown("# ๐ŸŒ AIoT & Edge AI Simulator")
gr.Markdown("Test AIoT deployments - **Anktechsol**")
with gr.Row():
with gr.Column():
device = gr.Dropdown(["Raspberry Pi 4", "Jetson Nano", "AWS IoT Greengrass", "Azure IoT Edge"], label="Edge Device", value="Raspberry Pi 4")
model = gr.Dropdown(["Object Detection", "Image Classification", "Anomaly Detection", "Predictive Model"], label="AI Model", value="Object Detection")
location = gr.Radio(["Factory Floor", "Warehouse", "Retail Store", "Remote Site"], label="Deployment Location", value="Factory Floor")
btn = gr.Button("Run Simulation")
with gr.Column():
output = gr.Markdown()
btn.click(simulate_edge, inputs=[device, model, location], outputs=output)
gr.Markdown("""---
### Anktechsol - AIoT Specialists
Edge AI deployment & AIoT consulting. [Get started](https://anktechsol.com)""")
demo.launch()