heffnt commited on
Commit
4b38e3a
·
1 Parent(s): 7d8aa3e

Enhance error handling in app.py for background image loading and update Discord notification message format.

Browse files
.github/workflows/discord-notification.yml CHANGED
@@ -13,5 +13,5 @@ jobs:
13
  DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} # Make sure to set this Webhook URL in Github Secrets!
14
  run: |
15
  curl -X POST -H "Content-Type: application/json" \
16
- -d "{\"content\": \"A new commit was pushed to the main branch by $GITHUB_ACTOR.\n\n**Commit Message:** ${{ github.event.head_commit.message }}\"}" \
17
  $DISCORD_WEBHOOK_URL
 
13
  DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} # Make sure to set this Webhook URL in Github Secrets!
14
  run: |
15
  curl -X POST -H "Content-Type: application/json" \
16
+ -d "{\"content\": \"Commit was pushed to main branch by $GITHUB_ACTOR: ${{ github.event.head_commit.message }}\"}" \
17
  $DISCORD_WEBHOOK_URL
app.py CHANGED
@@ -25,12 +25,13 @@ try:
25
  with open(BACKGROUND_IMAGE_PATH, "rb") as _img_f:
26
  _encoded_img = base64.b64encode(_img_f.read()).decode("ascii")
27
  BACKGROUND_DATA_URL = f"data:image/png;base64,{_encoded_img}"
28
- except Exception:
 
29
  BACKGROUND_DATA_URL = ""
30
 
31
  # Fancy styling
32
  fancy_css = f"""
33
- html, body, #root, .gradio-container {{
34
  background-image: url('{BACKGROUND_DATA_URL}');
35
  background-repeat: repeat;
36
  background-size: auto;
@@ -40,7 +41,7 @@ fancy_css = f"""
40
  max-width: 700px;
41
  margin: 0 auto;
42
  padding: 20px;
43
- background-color: #2a2a2a;
44
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
45
  border-radius: 10px;
46
  font-family: 'Arial', sans-serif;
 
25
  with open(BACKGROUND_IMAGE_PATH, "rb") as _img_f:
26
  _encoded_img = base64.b64encode(_img_f.read()).decode("ascii")
27
  BACKGROUND_DATA_URL = f"data:image/png;base64,{_encoded_img}"
28
+ except Exception as e:
29
+ print(f"Error loading background image: {e}")
30
  BACKGROUND_DATA_URL = ""
31
 
32
  # Fancy styling
33
  fancy_css = f"""
34
+ html, body, #root {{
35
  background-image: url('{BACKGROUND_DATA_URL}');
36
  background-repeat: repeat;
37
  background-size: auto;
 
41
  max-width: 700px;
42
  margin: 0 auto;
43
  padding: 20px;
44
+ background-color: #2d2d2d;
45
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
46
  border-radius: 10px;
47
  font-family: 'Arial', sans-serif;