mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-12 10:34:32 +08:00
commit
e88c750637
@ -16,6 +16,11 @@
|
||||
<meta name="twitter:title" content="{{ config['title'] or '' }}">
|
||||
<meta name="twitter:description" content="{{ config['description'] or '' }}">
|
||||
<meta name="twitter:image" content="{{ config['thumbnail'] or '' }}">
|
||||
{%if config['favicon_path']%}
|
||||
<link rel="shortcut icon" href="{{ config['favicon_path']}}">
|
||||
{%else%}
|
||||
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
|
||||
{%endif%}
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156449732-1"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
|
@ -123,23 +123,6 @@ def static_resource(path: str):
|
||||
raise HTTPException(status_code=404, detail="Static file not found")
|
||||
|
||||
|
||||
@app.get('/favicon.ico')
|
||||
async def favicon():
|
||||
if app.favicon_path:
|
||||
return FileResponse(app.favicon_path)
|
||||
else:
|
||||
try:
|
||||
favicon_path = "media/logo.ico"
|
||||
if app.interface.share:
|
||||
return RedirectResponse(GRADIO_STATIC_ROOT + favicon_path)
|
||||
else:
|
||||
static_file = safe_join(STATIC_PATH_LIB, favicon_path)
|
||||
if static_file is not None:
|
||||
return FileResponse(static_file)
|
||||
except (RuntimeError, FileNotFoundError):
|
||||
raise HTTPException(status_code=404, detail="Favicon file missing")
|
||||
|
||||
|
||||
@app.get("/api", response_class=HTMLResponse) # Needed for Spaces
|
||||
@app.get("/api/", response_class=HTMLResponse)
|
||||
def api_docs(request: Request):
|
||||
@ -333,10 +316,10 @@ if __name__ == '__main__': # Run directly for debugging: python app.py
|
||||
from gradio import Interface
|
||||
app.interface = Interface(lambda x: "Hello, " + x, "text", "text",
|
||||
analytics_enabled=False)
|
||||
app.interface.favicon_path = None
|
||||
app.interface.config = app.interface.get_config_file()
|
||||
app.interface.show_error = True
|
||||
app.interface.flagging_callback.setup(app.interface.flagging_dir)
|
||||
app.favicon_path = None
|
||||
app.tokens = {}
|
||||
|
||||
auth = True
|
||||
|
@ -317,6 +317,7 @@ class Interface:
|
||||
"Please use the `enable_queue` parameter in "
|
||||
"`launch()` instead")
|
||||
|
||||
self.favicon_path = None
|
||||
self.height = height
|
||||
self.width = width
|
||||
if self.height is not None or self.width is not None:
|
||||
|
@ -1 +1 @@
|
||||
<!doctype html><html lang="en" style="height:100%;margin:0;padding:0"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><title>{{ config['title'] or 'Gradio' }}</title><meta property="og:url" content="https://gradio.app/"/><meta property="og:type" content="website"/><meta property="og:image" content="{{ config['thumbnail'] or '' }}"/><meta property="og:title" content="{{ config['title'] or '' }}"/><meta property="og:description" content="{{ config['description'] or '' }}"/><meta name="twitter:card" content="summary_large_image"><meta name="twitter:creator" content="@teamGradio"><meta name="twitter:title" content="{{ config['title'] or '' }}"><meta name="twitter:description" content="{{ config['description'] or '' }}"><meta name="twitter:image" content="{{ config['thumbnail'] or '' }}"><script async src="https://www.googletagmanager.com/gtag/js?id=UA-156449732-1"></script><script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-156449732-1"),window.gradio_mode="app"</script><script>window.gradio_config = {{ config|tojson }};</script><script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"></script><title>Gradio</title><link href="static/bundle.css" rel="stylesheet"><link href="static/css/main.07d1e470.css" rel="stylesheet"></head><body style="height:100%;margin:0;padding:0"><div id="root" style="height:100%"></div><script src="static/bundle.js"></script></body></html>
|
||||
<!doctype html><html lang="en" style="height:100%;margin:0;padding:0"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><title>{{ config['title'] or 'Gradio' }}</title><meta property="og:url" content="https://gradio.app/"/><meta property="og:type" content="website"/><meta property="og:image" content="{{ config['thumbnail'] or '' }}"/><meta property="og:title" content="{{ config['title'] or '' }}"/><meta property="og:description" content="{{ config['description'] or '' }}"/><meta name="twitter:card" content="summary_large_image"><meta name="twitter:creator" content="@teamGradio"><meta name="twitter:title" content="{{ config['title'] or '' }}"><meta name="twitter:description" content="{{ config['description'] or '' }}"><meta name="twitter:image" content="{{ config['thumbnail'] or '' }}">{%if config['favicon_path']%}<link rel="shortcut icon" href="{{ config['favicon_path']}}">{%else%}<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">{%endif%}<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156449732-1"></script><script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-156449732-1"),window.gradio_mode="app"</script><script>window.gradio_config = {{ config|tojson }};</script><script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"></script><title>Gradio</title><link href="static/bundle.css" rel="stylesheet"><link href="static/css/main.07d1e470.css" rel="stylesheet"></head><body style="height:100%;margin:0;padding:0"><div id="root" style="height:100%"></div><script src="static/bundle.js"></script></body></html>
|
@ -196,6 +196,7 @@ def get_config_file(interface: Interface) -> Dict[str, Any]:
|
||||
"queue": interface.enable_queue,
|
||||
"cached_examples": interface.cache_examples if hasattr(interface, "cache_examples") else False,
|
||||
"version": pkg_resources.require("gradio")[0].version,
|
||||
"favicon_path": interface.favicon_path
|
||||
}
|
||||
try:
|
||||
param_names = inspect.getfullargspec(interface.predict[0])[0]
|
||||
|
Loading…
Reference in New Issue
Block a user