sreelekhaputta2 commited on
Commit
bf2ed00
Β·
verified Β·
1 Parent(s): 90fec3d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -24
app.py CHANGED
@@ -3,7 +3,7 @@ import random
3
  import gradio as gr
4
  import base64
5
 
6
- # Load JSON
7
  with open("gita_techies_18_chapters.json", "r", encoding="utf-8") as f:
8
  gita_for_techies = json.load(f)
9
 
@@ -11,7 +11,7 @@ with open("gita_techies_18_chapters.json", "r", encoding="utf-8") as f:
11
  with open("bg.png", "rb") as img_file:
12
  b64_bg_img = base64.b64encode(img_file.read()).decode()
13
 
14
- # Function to display one entry
15
  def get_gita_tech():
16
  entry = random.choice(gita_for_techies)
17
  return f"""
@@ -34,37 +34,39 @@ def get_gita_tech():
34
  <pre><code>{entry["code_snippet"]}</code></pre>
35
 
36
  <hr style="margin-top: 30px;">
37
- <p style="text-align:center;font-size:3.5vw;">🌸 Made with πŸ’œ by <b>Sreelekha Putta</b></p>
38
  </div>
39
 
40
  <style>
41
  .content {{
42
  background: rgba(20, 15, 35, 0.92);
43
- padding: 5vw;
44
- border-radius: 5vw;
45
- width: 92vw;
46
  max-width: 800px;
47
- margin: 0 auto 6vw auto;
48
- box-shadow: 0 0 20px #ab71f7;
 
49
  color: #ffffff !important;
50
  font-family: 'Segoe UI', sans-serif;
51
- text-shadow: 1px 1px 6px rgba(0, 0, 0, 1);
 
52
  word-wrap: break-word;
53
  overflow-wrap: break-word;
54
- font-size: 4vw;
55
- line-height: 1.7;
 
56
  }}
57
- .content h2 {{
58
- font-size: 5.5vw;
59
- margin-bottom: 4vw;
60
  color: #d9b2ff;
61
  }}
62
  pre {{
63
  background: #0e0e23;
64
  color: #e0f2fe;
65
- padding: 3vw;
66
- border-radius: 3vw;
67
- font-size: 3.5vw;
68
  overflow-x: auto;
69
  box-shadow: 0 0 10px rgba(255,255,255,0.1);
70
  text-shadow: none;
@@ -72,7 +74,7 @@ def get_gita_tech():
72
  </style>
73
  """
74
 
75
- # CSS block
76
  css = f"""
77
  body {{
78
  margin: 0;
@@ -97,9 +99,9 @@ body::before {{
97
  h1 {{
98
  text-align: center;
99
  color: #e7c1ff;
100
- font-size: 6vw;
101
  font-weight: 700;
102
- margin: 6vw 4vw 4vw 4vw;
103
  text-shadow: 0 0 15px #c084fc;
104
  }}
105
 
@@ -108,11 +110,11 @@ button {{
108
  border-radius: 12px;
109
  color: white;
110
  font-weight: 600;
111
- font-size: 4.5vw;
112
- padding: 3vw 7vw;
113
  border: none;
114
  cursor: pointer;
115
- margin-bottom: 6vw;
116
  box-shadow: 0 0 18px #a78bfa88;
117
  }}
118
 
@@ -123,7 +125,7 @@ button:hover {{
123
  }}
124
  """
125
 
126
- # Gradio app
127
  with gr.Blocks(css=css) as app:
128
  gr.Markdown("<h1>πŸ’» Bhagavad Gita for Techies πŸ’»</h1>")
129
  output = gr.HTML()
 
3
  import gradio as gr
4
  import base64
5
 
6
+ # Load JSON dataset
7
  with open("gita_techies_18_chapters.json", "r", encoding="utf-8") as f:
8
  gita_for_techies = json.load(f)
9
 
 
11
  with open("bg.png", "rb") as img_file:
12
  b64_bg_img = base64.b64encode(img_file.read()).decode()
13
 
14
+ # Function to return one random entry
15
  def get_gita_tech():
16
  entry = random.choice(gita_for_techies)
17
  return f"""
 
34
  <pre><code>{entry["code_snippet"]}</code></pre>
35
 
36
  <hr style="margin-top: 30px;">
37
+ <p style="text-align:center;font-size:0.9rem;">🌸 Made with πŸ’œ by <b>Sreelekha Putta</b></p>
38
  </div>
39
 
40
  <style>
41
  .content {{
42
  background: rgba(20, 15, 35, 0.92);
43
+ padding: 20px;
44
+ border-radius: 16px;
 
45
  max-width: 800px;
46
+ width: 92%;
47
+ margin: 0 auto 30px auto;
48
+ box-shadow: 0 0 25px #ab71f7;
49
  color: #ffffff !important;
50
  font-family: 'Segoe UI', sans-serif;
51
+ font-size: 1rem;
52
+ line-height: 1.8;
53
  word-wrap: break-word;
54
  overflow-wrap: break-word;
55
+ text-shadow: 1px 1px 5px rgba(0, 0, 0, 1);
56
+ -webkit-font-smoothing: antialiased;
57
+ -moz-osx-font-smoothing: grayscale;
58
  }}
59
+ h2 {{
60
+ font-size: 1.5rem;
61
+ margin-bottom: 16px;
62
  color: #d9b2ff;
63
  }}
64
  pre {{
65
  background: #0e0e23;
66
  color: #e0f2fe;
67
+ padding: 12px;
68
+ border-radius: 8px;
69
+ font-size: 0.95rem;
70
  overflow-x: auto;
71
  box-shadow: 0 0 10px rgba(255,255,255,0.1);
72
  text-shadow: none;
 
74
  </style>
75
  """
76
 
77
+ # CSS with background
78
  css = f"""
79
  body {{
80
  margin: 0;
 
99
  h1 {{
100
  text-align: center;
101
  color: #e7c1ff;
102
+ font-size: 2.8rem;
103
  font-weight: 700;
104
+ margin: 30px 0 20px 0;
105
  text-shadow: 0 0 15px #c084fc;
106
  }}
107
 
 
110
  border-radius: 12px;
111
  color: white;
112
  font-weight: 600;
113
+ font-size: 1.3rem;
114
+ padding: 0.8rem 2.4rem;
115
  border: none;
116
  cursor: pointer;
117
+ margin-bottom: 30px;
118
  box-shadow: 0 0 18px #a78bfa88;
119
  }}
120
 
 
125
  }}
126
  """
127
 
128
+ # Gradio interface
129
  with gr.Blocks(css=css) as app:
130
  gr.Markdown("<h1>πŸ’» Bhagavad Gita for Techies πŸ’»</h1>")
131
  output = gr.HTML()