Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,6 +26,7 @@ html_template = """
|
|
26 |
<meta name="twitter:player:height" content="480">
|
27 |
<meta name="twitter:player:stream" content="https://broadfield-dev-gradio-sketch.hf.space">
|
28 |
<title>Gradio Sketch Demo</title>
|
|
|
29 |
</head>
|
30 |
<body>
|
31 |
{{ gradio_ui|safe }}
|
@@ -46,10 +47,12 @@ def create_gradio_interface():
|
|
46 |
@app.route('/')
|
47 |
def index():
|
48 |
gradio_app = create_gradio_interface()
|
49 |
-
#
|
50 |
-
gradio_html = gradio_app.
|
51 |
-
|
|
|
|
|
52 |
|
53 |
if __name__ == "__main__":
|
54 |
-
# For Hugging Face Spaces, use port 7860
|
55 |
app.run(host="0.0.0.0", port=7860, debug=False)
|
|
|
26 |
<meta name="twitter:player:height" content="480">
|
27 |
<meta name="twitter:player:stream" content="https://broadfield-dev-gradio-sketch.hf.space">
|
28 |
<title>Gradio Sketch Demo</title>
|
29 |
+
{{ gradio_css|safe }}
|
30 |
</head>
|
31 |
<body>
|
32 |
{{ gradio_ui|safe }}
|
|
|
47 |
@app.route('/')
|
48 |
def index():
|
49 |
gradio_app = create_gradio_interface()
|
50 |
+
# Get the Gradio UI as HTML without launching a separate server
|
51 |
+
gradio_html = gradio_app.blocks().to_html()
|
52 |
+
# Include Gradio CSS (optional, for styling)
|
53 |
+
gradio_css = '<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gradio/dist/gradio.css">'
|
54 |
+
return render_template_string(html_template, gradio_ui=gradio_html, gradio_css=gradio_css)
|
55 |
|
56 |
if __name__ == "__main__":
|
57 |
+
# For Hugging Face Spaces, use port 7860 for Flask
|
58 |
app.run(host="0.0.0.0", port=7860, debug=False)
|