GoogleCalc commited on
Commit
4562227
·
verified ·
1 Parent(s): 35b56a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py CHANGED
@@ -7,6 +7,8 @@ import urllib.parse
7
  from datetime import datetime, timezone
8
  from pathlib import Path
9
  import threading
 
 
10
 
11
  import gradio as gr
12
  from pathlib import Path
@@ -1995,6 +1997,29 @@ with gr.Blocks(title=APP_NAME, analytics_enabled=False) as demo:
1995
  # START APP
1996
  # ============================================================
1997
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1998
  if __name__ == "__main__":
1999
  port = int(os.environ.get("PORT", 7860))
2000
 
 
7
  from datetime import datetime, timezone
8
  from pathlib import Path
9
  import threading
10
+ from fastapi import FastAPI
11
+ from fastapi.responses import Response
12
 
13
  import gradio as gr
14
  from pathlib import Path
 
1997
  # START APP
1998
  # ============================================================
1999
 
2000
+ # ============================================================
2001
+ # SEO SITEMAP
2002
+ # ============================================================
2003
+
2004
+ SITEMAP_XML = """<?xml version="1.0" encoding="UTF-8"?>
2005
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
2006
+ <url>
2007
+ <loc>https://www.howmuchfeed.com/</loc>
2008
+ </url>
2009
+ </urlset>
2010
+ """
2011
+
2012
+ app = FastAPI()
2013
+
2014
+ @app.get("/sitemap.xml")
2015
+ def sitemap():
2016
+ return Response(
2017
+ content=SITEMAP_XML,
2018
+ media_type="application/xml"
2019
+ )
2020
+
2021
+ app = gr.mount_gradio_app(app, demo, path="/")
2022
+
2023
  if __name__ == "__main__":
2024
  port = int(os.environ.get("PORT", 7860))
2025