File size: 1,870 Bytes
c6da498
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import gradio as gr
import random

def analyze_data(data_source, timeframe, metric):
    data_points = random.randint(5000, 50000)
    avg_value = round(random.uniform(20, 80), 2)
    peak = round(random.uniform(80, 100), 2)
    anomalies = random.randint(0, 15)
    
    result = f"""### IoT Data Analysis Results

**Data Source**: {data_source}  
**Timeframe**: {timeframe}  
**Metric**: {metric}

๐Ÿ“Š **Analysis Summary**:
- Total Data Points: {data_points:,}
- Average Value: {avg_value}
- Peak Value: {peak}
- Anomalies Detected: {anomalies}
- Data Quality Score: {round(random.uniform(85, 99), 1)}%

**Insights**: The IoT data shows {'consistent patterns' if anomalies < 5 else 'some irregularities'} over the {timeframe.lower()} period.

---
**Anktechsol** - IoT Analytics Platform  
๐Ÿ”— [Visit anktechsol.com](https://anktechsol.com)"""
    return result

with gr.Blocks(title="IoT Data Analyzer") as demo:
    gr.Markdown("# ๐Ÿ“Š IoT Data Analytics Platform")
    gr.Markdown("Advanced IoT data insights - **Anktechsol**")
    
    with gr.Row():
        with gr.Column():
            source = gr.Dropdown(["Temperature Sensors", "Humidity Sensors", "Pressure Sensors", "Motion Detectors"], label="Data Source", value="Temperature Sensors")
            time = gr.Radio(["Last Hour", "Last 24 Hours", "Last 7 Days", "Last 30 Days"], label="Timeframe", value="Last 24 Hours")
            metric = gr.Dropdown(["Average", "Peak", "Trend Analysis", "Anomaly Detection"], label="Analysis Metric", value="Average")
            btn = gr.Button("Analyze Data")
        
        with gr.Column():
            output = gr.Markdown()
    
    btn.click(analyze_data, inputs=[source, time, metric], outputs=output)
    
    gr.Markdown("""---
### Anktechsol - IoT Analytics Experts
Comprehensive IoT data solutions. [Contact us](https://anktechsol.com)""")

demo.launch()