Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -101,46 +101,18 @@ def predict(image):
|
|
101 |
inputs = gr.inputs.Image(type="pil")
|
102 |
outputs = gr.outputs.JSON()
|
103 |
|
104 |
-
|
105 |
-
html_template = """
|
106 |
-
<!DOCTYPE html>
|
107 |
-
<html>
|
108 |
-
<head>
|
109 |
-
<title>Naked Detector</title>
|
110 |
-
<style>
|
111 |
-
/* Your CSS styles here */
|
112 |
-
.footer {
|
113 |
-
position: fixed;
|
114 |
-
left: 0;
|
115 |
-
bottom: 0;
|
116 |
-
width: 100%;
|
117 |
-
background-color: #f5f5f5;
|
118 |
-
text-align: center;
|
119 |
-
padding: 10px;
|
120 |
-
}
|
121 |
-
</style>
|
122 |
-
</head>
|
123 |
-
<body>
|
124 |
-
<!-- Gradio interface placeholder -->
|
125 |
-
<div id="interface"></div>
|
126 |
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
<script>
|
136 |
-
// Gradio code here
|
137 |
-
const iface = gr.Interface(fn, inputs, outputs);
|
138 |
-
iface.launch({ target: '#interface' });
|
139 |
-
</script>
|
140 |
-
</body>
|
141 |
-
</html>
|
142 |
-
"""
|
143 |
|
144 |
-
# Create a Gradio interface with the HTML template
|
145 |
-
interface = gr.Interface(predict, inputs, outputs, title="Naked Detector", webapp=True, allow_screenshot=False, allow_flagging=False, template=html_template)
|
146 |
interface.launch()
|
|
|
101 |
inputs = gr.inputs.Image(type="pil")
|
102 |
outputs = gr.outputs.JSON()
|
103 |
|
104 |
+
text_element = "This model and website are created by KUO SUKO, C110156115 from NKUST"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
+
interface = gr.Interface(
|
107 |
+
title="Naked Detector",
|
108 |
+
description="🍆😳",
|
109 |
+
inputs=inputs,
|
110 |
+
outputs=outputs,
|
111 |
+
examples=[[Image.new("RGB", (224, 224))]],
|
112 |
+
theme="default",
|
113 |
+
)
|
114 |
|
115 |
+
interface.interface.layout.footer[0].style["display"] = "none" # Hide the default footer
|
116 |
+
interface.interface.layout.footer.append(gr.InterfaceText(text_element)) # Add the custom text element
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
|
|
|
|
118 |
interface.launch()
|