Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -135,22 +135,19 @@ def predict(image, score_threshold: float,
|
|
| 135 |
|
| 136 |
return (a,c,res,info)
|
| 137 |
|
| 138 |
-
|
| 139 |
def main():
|
| 140 |
args = parse_args()
|
| 141 |
model = load_model()
|
| 142 |
labels = load_labels()
|
| 143 |
|
|
|
|
| 144 |
func = functools.partial(predict, model=model, labels=labels)
|
| 145 |
-
func = functools.update_wrapper(func, predict)
|
| 146 |
|
| 147 |
gr.Interface(
|
| 148 |
func,
|
| 149 |
[
|
| 150 |
-
gr.Image(
|
| 151 |
-
gr.Slider(0,
|
| 152 |
-
1,
|
| 153 |
-
label='Score Threshold'),
|
| 154 |
],
|
| 155 |
[
|
| 156 |
gr.Textbox(label='Output (string)'),
|
|
@@ -173,5 +170,6 @@ PNG Info code forked from [AUTOMATIC1111/stable-diffusion-webui](https://github.
|
|
| 173 |
)
|
| 174 |
|
| 175 |
|
|
|
|
| 176 |
if __name__ == '__main__':
|
| 177 |
main()
|
|
|
|
| 135 |
|
| 136 |
return (a,c,res,info)
|
| 137 |
|
|
|
|
| 138 |
def main():
|
| 139 |
args = parse_args()
|
| 140 |
model = load_model()
|
| 141 |
labels = load_labels()
|
| 142 |
|
| 143 |
+
# Here, no need to pass `model` and `labels` explicitly to `predict` since `functools.partial` already pre-fills those.
|
| 144 |
func = functools.partial(predict, model=model, labels=labels)
|
|
|
|
| 145 |
|
| 146 |
gr.Interface(
|
| 147 |
func,
|
| 148 |
[
|
| 149 |
+
gr.Image(label='img'),
|
| 150 |
+
gr.Slider(0, 1, label='Score Threshold'),
|
|
|
|
|
|
|
| 151 |
],
|
| 152 |
[
|
| 153 |
gr.Textbox(label='Output (string)'),
|
|
|
|
| 170 |
)
|
| 171 |
|
| 172 |
|
| 173 |
+
|
| 174 |
if __name__ == '__main__':
|
| 175 |
main()
|