sreelekhaputta2 commited on
Commit
8d05c91
Β·
verified Β·
1 Parent(s): a12efc5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -13
app.py CHANGED
@@ -3,15 +3,15 @@ import random
3
  import gradio as gr
4
  import base64
5
 
6
- # Load JSON data
7
  with open("gita_techies_18_chapters.json", "r", encoding="utf-8") as f:
8
  gita_for_techies = json.load(f)
9
 
10
- # Load and encode bg image
11
  with open("bg.png", "rb") as img_file:
12
  b64_bg_img = base64.b64encode(img_file.read()).decode()
13
 
14
- # Function to fetch one entry
15
  def get_gita_tech():
16
  entry = random.choice(gita_for_techies)
17
  return f"""
@@ -45,28 +45,32 @@ def get_gita_tech():
45
  max-width: 800px;
46
  margin: 0 auto 30px auto;
47
  box-shadow: 0 0 20px #ab71f7;
48
- color: #ffffff;
49
  font-family: 'Segoe UI', sans-serif;
50
  animation: fadeIn 1.5s ease forwards;
51
- text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.6);
 
 
52
  }}
53
  pre {{
54
- background: #111827;
55
  color: #e0f2fe;
56
  padding: 12px;
57
  border-radius: 10px;
58
  font-size: 0.95rem;
59
  overflow-x: auto;
60
- box-shadow: 0 0 10px rgba(255,255,255,0.08);
 
61
  }}
62
  @keyframes fadeIn {{
63
- from {{ opacity: 0; transform: translateY(20px); }}
64
- to {{ opacity: 1; transform: translateY(0); }}
65
  }}
66
  @media screen and (max-width: 600px) {{
67
  .content {{
68
- padding: 16px;
69
- font-size: 0.95rem;
 
70
  }}
71
  h2 {{
72
  font-size: 1.5rem;
@@ -74,11 +78,14 @@ def get_gita_tech():
74
  pre {{
75
  font-size: 0.85rem;
76
  }}
 
 
 
77
  }}
78
  </style>
79
  """
80
 
81
- # CSS with responsive background
82
  css = f"""
83
  body {{
84
  margin: 0;
@@ -125,7 +132,7 @@ button:hover {{
125
  }}
126
  """
127
 
128
- # Gradio app
129
  with gr.Blocks(css=css) as app:
130
  gr.Markdown("<h1>πŸ’» Bhagavad Gita for Techies πŸ’»</h1>")
131
  output = gr.HTML()
 
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
 
10
+ # Encode background image
11
  with open("bg.png", "rb") as img_file:
12
  b64_bg_img = base64.b64encode(img_file.read()).decode()
13
 
14
+ # Function to get a Gita tech entry
15
  def get_gita_tech():
16
  entry = random.choice(gita_for_techies)
17
  return f"""
 
45
  max-width: 800px;
46
  margin: 0 auto 30px auto;
47
  box-shadow: 0 0 20px #ab71f7;
48
+ color: #ffffff !important;
49
  font-family: 'Segoe UI', sans-serif;
50
  animation: fadeIn 1.5s ease forwards;
51
+ text-shadow: 1px 1px 6px rgba(0, 0, 0, 1);
52
+ word-wrap: break-word;
53
+ overflow-wrap: break-word;
54
  }}
55
  pre {{
56
+ background: #0e0e23;
57
  color: #e0f2fe;
58
  padding: 12px;
59
  border-radius: 10px;
60
  font-size: 0.95rem;
61
  overflow-x: auto;
62
+ box-shadow: 0 0 10px rgba(255,255,255,0.1);
63
+ text-shadow: none;
64
  }}
65
  @keyframes fadeIn {{
66
+ from {{opacity: 0; transform: translateY(20px);}}
67
+ to {{opacity: 1; transform: translateY(0);}}
68
  }}
69
  @media screen and (max-width: 600px) {{
70
  .content {{
71
+ padding: 14px;
72
+ font-size: 0.94rem;
73
+ line-height: 1.6;
74
  }}
75
  h2 {{
76
  font-size: 1.5rem;
 
78
  pre {{
79
  font-size: 0.85rem;
80
  }}
81
+ body {{
82
+ padding: 10px;
83
+ }}
84
  }}
85
  </style>
86
  """
87
 
88
+ # CSS with fixed background
89
  css = f"""
90
  body {{
91
  margin: 0;
 
132
  }}
133
  """
134
 
135
+ # Gradio interface
136
  with gr.Blocks(css=css) as app:
137
  gr.Markdown("<h1>πŸ’» Bhagavad Gita for Techies πŸ’»</h1>")
138
  output = gr.HTML()