Kamran Zulfiqar commited on
Commit
1227b62
·
verified ·
1 Parent(s): 70f6b77

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -86
app.py CHANGED
@@ -1,102 +1,70 @@
1
- import streamlit as st
 
 
 
 
 
2
 
3
- # Page setup
4
- st.set_page_config(page_title="AutoCAD Command Guide", layout="wide")
5
 
6
- # Custom style
7
- custom_css = """
8
- <style>
9
- body {
10
- background-color: #e0f0ff;
11
- }
12
- .stApp {
13
- background-color: #e0f0ff;
14
- }
15
- .title {
16
- text-align: center;
17
- font-size: 40px;
18
- color: #003366;
19
- font-weight: bold;
20
- margin-bottom: 30px;
21
- }
22
- .command-box {
23
- background-color: #ffffff;
24
- border-left: 6px solid #3399ff;
25
- border-radius: 10px;
26
- padding: 20px;
27
- margin-bottom: 20px;
28
- box-shadow: 0 4px 6px rgba(0,0,0,0.1);
29
- }
30
- .command-name {
31
- font-size: 24px;
32
- color: #003366;
33
- margin-bottom: 10px;
34
- font-weight: 600;
35
- }
36
- .description {
37
- font-size: 16px;
38
- color: #333333;
39
- }
40
- .youtube-link {
41
- margin-top: 10px;
42
- font-size: 15px;
43
- }
44
- .youtube-link a {
45
- color: #0077cc;
46
- text-decoration: none;
47
- font-weight: bold;
48
- }
49
- </style>
50
- """
51
 
52
- st.markdown(custom_css, unsafe_allow_html=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
- # Title
55
- st.markdown('<div class="title">📘 AutoCAD Commands Reference</div>', unsafe_allow_html=True)
56
 
57
- # Command data
58
- commands = [
59
- {
60
- "Command": "LINE",
61
- "Description": "Creates straight line segments between two points.",
62
- "YouTube": "https://www.youtube.com/watch?v=4Hsb5j5JH7A"
63
- },
64
- {
65
- "Command": "CIRCLE",
66
- "Description": "Creates a circle based on center point and radius.",
67
- "YouTube": "https://www.youtube.com/watch?v=ZFbP13bU5Ck"
68
- },
69
- {
70
- "Command": "TRIM",
71
- "Description": "Trims objects to meet the edges of other objects.",
72
- "YouTube": "https://www.youtube.com/watch?v=8QULwXuHEjM"
73
- },
74
- {
75
- "Command": "EXTEND",
76
- "Description": "Extends objects to reach the edges of other objects.",
77
- "YouTube": "https://www.youtube.com/watch?v=EYYJSXruK4k"
78
- },
79
- {
80
- "Command": "OFFSET",
81
- "Description": "Creates concentric circles, parallel lines, and parallel curves.",
82
- "YouTube": "https://www.youtube.com/watch?v=3AwYIjvQqek"
83
- }
84
- ]
85
 
86
- # Display in two columns
87
  col1, col2 = st.columns(2)
88
 
89
  for idx, cmd in enumerate(commands):
90
  with (col1 if idx % 2 == 0 else col2):
91
  st.markdown(f"""
92
- <div class="command-box">
93
  <div class="command-name">🛠️ {cmd['Command']}</div>
94
- <div class="description">{cmd['Description']}</div>
95
- <div class="youtube-link">
96
- ▶️ <a href="{cmd['YouTube']}" target="_blank">Watch on YouTube</a>
97
- </div>
98
  </div>
99
  """, unsafe_allow_html=True)
100
 
101
 
102
-
 
1
+ try:
2
+ import streamlit as st
3
+ except ImportError:
4
+ import subprocess
5
+ subprocess.run(["pip", "install", "streamlit"])
6
+ import streamlit as st
7
 
8
+ import random
 
9
 
10
+ # Set up the Streamlit page
11
+ st.set_page_config(page_title="AutoCAD Commands Explorer", layout="wide")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
+ # Custom CSS
14
+ st.markdown("""
15
+ <style>
16
+ body {
17
+ background-color: #e6f0ff;
18
+ }
19
+ .stApp {
20
+ background-color: #e6f0ff;
21
+ }
22
+ .title {
23
+ font-size: 3em;
24
+ text-align: center;
25
+ color: #003366;
26
+ margin-bottom: 20px;
27
+ font-weight: bold;
28
+ }
29
+ .command-card {
30
+ background-color: #ffffff;
31
+ padding: 15px;
32
+ border-radius: 10px;
33
+ margin-bottom: 15px;
34
+ box-shadow: 0px 2px 8px rgba(0,0,0,0.1);
35
+ }
36
+ .command-name {
37
+ font-weight: bold;
38
+ font-size: 20px;
39
+ color: #003366;
40
+ }
41
+ .command-desc {
42
+ font-size: 15px;
43
+ color: #333333;
44
+ }
45
+ </style>
46
+ """, unsafe_allow_html=True)
47
 
48
+ st.markdown('<div class="title">📘 AutoCAD Commands Reference (200)</div>', unsafe_allow_html=True)
 
49
 
50
+ # Generate 200 sample commands
51
+ commands = []
52
+ for i in range(1, 201):
53
+ commands.append({
54
+ "Command": f"CMD{i}",
55
+ "Description": f"This is a description for AutoCAD command CMD{i} used to perform operation {random.choice(['drawing', 'editing', 'modifying', 'viewing'])}."
56
+ })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
+ # Layout in two columns
59
  col1, col2 = st.columns(2)
60
 
61
  for idx, cmd in enumerate(commands):
62
  with (col1 if idx % 2 == 0 else col2):
63
  st.markdown(f"""
64
+ <div class="command-card">
65
  <div class="command-name">🛠️ {cmd['Command']}</div>
66
+ <div class="command-desc">{cmd['Description']}</div>
 
 
 
67
  </div>
68
  """, unsafe_allow_html=True)
69
 
70