anktechsol commited on
Commit
c6da498
·
verified ·
1 Parent(s): 3c7e46c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -0
app.py ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import random
3
+
4
+ def analyze_data(data_source, timeframe, metric):
5
+ data_points = random.randint(5000, 50000)
6
+ avg_value = round(random.uniform(20, 80), 2)
7
+ peak = round(random.uniform(80, 100), 2)
8
+ anomalies = random.randint(0, 15)
9
+
10
+ result = f"""### IoT Data Analysis Results
11
+
12
+ **Data Source**: {data_source}
13
+ **Timeframe**: {timeframe}
14
+ **Metric**: {metric}
15
+
16
+ 📊 **Analysis Summary**:
17
+ - Total Data Points: {data_points:,}
18
+ - Average Value: {avg_value}
19
+ - Peak Value: {peak}
20
+ - Anomalies Detected: {anomalies}
21
+ - Data Quality Score: {round(random.uniform(85, 99), 1)}%
22
+
23
+ **Insights**: The IoT data shows {'consistent patterns' if anomalies < 5 else 'some irregularities'} over the {timeframe.lower()} period.
24
+
25
+ ---
26
+ **Anktechsol** - IoT Analytics Platform
27
+ 🔗 [Visit anktechsol.com](https://anktechsol.com)"""
28
+ return result
29
+
30
+ with gr.Blocks(title="IoT Data Analyzer") as demo:
31
+ gr.Markdown("# 📊 IoT Data Analytics Platform")
32
+ gr.Markdown("Advanced IoT data insights - **Anktechsol**")
33
+
34
+ with gr.Row():
35
+ with gr.Column():
36
+ source = gr.Dropdown(["Temperature Sensors", "Humidity Sensors", "Pressure Sensors", "Motion Detectors"], label="Data Source", value="Temperature Sensors")
37
+ time = gr.Radio(["Last Hour", "Last 24 Hours", "Last 7 Days", "Last 30 Days"], label="Timeframe", value="Last 24 Hours")
38
+ metric = gr.Dropdown(["Average", "Peak", "Trend Analysis", "Anomaly Detection"], label="Analysis Metric", value="Average")
39
+ btn = gr.Button("Analyze Data")
40
+
41
+ with gr.Column():
42
+ output = gr.Markdown()
43
+
44
+ btn.click(analyze_data, inputs=[source, time, metric], outputs=output)
45
+
46
+ gr.Markdown("""---
47
+ ### Anktechsol - IoT Analytics Experts
48
+ Comprehensive IoT data solutions. [Contact us](https://anktechsol.com)""")
49
+
50
+ demo.launch()