TroglodyteDerivations commited on
Commit
157a87e
·
verified ·
1 Parent(s): 604f7bf

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +61 -0
app.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import plotly.graph_objects as go
3
+ import numpy as np
4
+
5
+ # Set page configuration
6
+ st.set_page_config(page_title="Pesadillas episodio ocho Broma de ingeniería eléctrica", layout="wide")
7
+
8
+ # Title of the app
9
+ st.title("Pesadillas episodio ocho Broma de ingeniería eléctrica")
10
+
11
+ # Display images
12
+ st.image('pesadillas.png', caption='Pesadillas')
13
+ st.image('pesadillas_electrical_engineering_joke.png', caption='Pesadillas broma de ingeniería eléctrica')
14
+
15
+ # Load and display the concatenated video
16
+ st.subheader("Video de Análisis")
17
+
18
+ # Define the filename of the concatenated video
19
+ video_filename = 'final_analisis_video.mp4'
20
+
21
+ # Display the video
22
+ st.video(video_filename)
23
+
24
+ # Plotly visualization
25
+ st.subheader("Visualización de Voltajes Primarios y Secundarios")
26
+
27
+ # Time array
28
+ t = np.linspace(0, 2 * np.pi, 1000)
29
+
30
+ # Define primary and secondary voltages for each example
31
+ examples = [
32
+ {"ep": 30, "es": 60},
33
+ {"ep": 35, "es": 70},
34
+ {"ep": 40, "es": 80},
35
+ {"ep": 45, "es": 90},
36
+ {"ep": 50, "es": 100},
37
+ {"ep": 60, "es": 120}
38
+ ]
39
+
40
+ # Create a figure
41
+ fig = go.Figure()
42
+
43
+ # Add traces for each example
44
+ for i, example in enumerate(examples):
45
+ ep = example["ep"] * np.sin(t)
46
+ es = example["es"] * np.sin(t)
47
+
48
+ fig.add_trace(go.Scatter(x=t, y=ep, mode='lines', name=f'Ejemplo {i+1} - e_p'))
49
+ fig.add_trace(go.Scatter(x=t, y=es, mode='lines', name=f'Ejemplo {i+1} - e_s'))
50
+
51
+ # Update layout for better visualization
52
+ fig.update_layout(
53
+ title="Voltajes Primarios (e_p) y Secundarios (e_s) en el Tiempo",
54
+ xaxis_title="Tiempo",
55
+ yaxis_title="Voltaje (V)",
56
+ legend_title="Leyenda",
57
+ template="plotly_white"
58
+ )
59
+
60
+ # Display the Plotly figure in the Streamlit app
61
+ st.plotly_chart(fig, use_container_width=True)