Spaces:
Running
Running
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 +0 -0
- src/constants.py +2 -2
- src/integrations/hume_api.py +2 -2
- src/main.py +6 -1
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': '
|
111 |
},
|
112 |
# Twitter Meta Tags
|
113 |
{
|
@@ -136,6 +136,6 @@ META_TAGS: List[Dict[str, str]] = [
|
|
136 |
},
|
137 |
{
|
138 |
'name': 'twitter:image',
|
139 |
-
'content': '
|
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,
|
177 |
-
clean_message = e.body[
|
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
|