zach commited on
Commit
323c87d
·
1 Parent(s): fe85e28

Add opengraph image asset and route to serve image from project for social media previews

Browse files
src/assets/arena-opengraph-logo.png ADDED
src/constants.py CHANGED
@@ -107,7 +107,7 @@ META_TAGS: List[Dict[str, str]] = [
107
  },
108
  {
109
  'property': 'og:image',
110
- 'content': 'https://opengraph.b-cdn.net/production/images/7990b8b3-f8ef-4ece-afce-70ca30795f5c.png?token=Ge7_YHHoQRRifYmbBOjex67tCoj3ZoPe_ty5ffWm-n8&height=630&width=1200&expires=33277213515'
111
  },
112
  # Twitter Meta Tags
113
  {
@@ -136,6 +136,6 @@ META_TAGS: List[Dict[str, str]] = [
136
  },
137
  {
138
  'name': 'twitter:image',
139
- 'content': 'https://opengraph.b-cdn.net/production/images/7990b8b3-f8ef-4ece-afce-70ca30795f5c.png?token=Ge7_YHHoQRRifYmbBOjex67tCoj3ZoPe_ty5ffWm-n8&height=630&width=1200&expires=33277213515'
140
  }
141
  ]
 
107
  },
108
  {
109
  'property': 'og:image',
110
+ 'content': '/static/arena-opengraph-logo.png'
111
  },
112
  # Twitter Meta Tags
113
  {
 
136
  },
137
  {
138
  'name': 'twitter:image',
139
+ 'content': '/static/arena-opengraph-logo.png'
140
  }
141
  ]
src/integrations/hume_api.py CHANGED
@@ -173,7 +173,7 @@ def _extract_hume_api_error_message(e: ApiError) -> str:
173
  """
174
  clean_message = GENERIC_API_ERROR_MESSAGE
175
 
176
- if hasattr(e, 'body') and isinstance(e.body, dict) and 'message' in e.body:
177
- clean_message = e.body['message']
178
 
179
  return clean_message
 
173
  """
174
  clean_message = GENERIC_API_ERROR_MESSAGE
175
 
176
+ if hasattr(e, "body") and isinstance(e.body, dict) and "message" in e.body:
177
+ clean_message = e.body["message"]
178
 
179
  return clean_message
src/main.py CHANGED
@@ -6,12 +6,14 @@ This module is the entry point for the app. It loads configuration and starts th
6
 
7
  # Standard Library Imports
8
  import asyncio
 
9
  from typing import Awaitable, Callable
10
 
11
  # Third-Party Library Imports
12
  import gradio as gr
13
  from fastapi import FastAPI, Request
14
  from fastapi.responses import Response
 
15
  from starlette.middleware.base import BaseHTTPMiddleware
16
 
17
  from src.config import Config, logger
@@ -89,11 +91,14 @@ async def main():
89
  app = FastAPI()
90
  app.add_middleware(ResponseModifierMiddleware)
91
 
 
 
 
92
  gr.mount_gradio_app(
93
  app=app,
94
  blocks=demo,
95
  path="/",
96
- allowed_paths=[str(config.audio_dir)]
97
  )
98
 
99
  import uvicorn
 
6
 
7
  # Standard Library Imports
8
  import asyncio
9
+ from pathlib import Path
10
  from typing import Awaitable, Callable
11
 
12
  # Third-Party Library Imports
13
  import gradio as gr
14
  from fastapi import FastAPI, Request
15
  from fastapi.responses import Response
16
+ from fastapi.staticfiles import StaticFiles
17
  from starlette.middleware.base import BaseHTTPMiddleware
18
 
19
  from src.config import Config, logger
 
91
  app = FastAPI()
92
  app.add_middleware(ResponseModifierMiddleware)
93
 
94
+ assets_dir = Path("src/assets")
95
+ app.mount("/static", StaticFiles(directory=assets_dir), name="static")
96
+
97
  gr.mount_gradio_app(
98
  app=app,
99
  blocks=demo,
100
  path="/",
101
+ allowed_paths=[str(config.audio_dir), "src/assets"]
102
  )
103
 
104
  import uvicorn