Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,7 @@ def predict_fn(input_img):
|
|
| 27 |
with torch.no_grad():
|
| 28 |
image_features = clip_model.encode_image(image).numpy()
|
| 29 |
input_df = pd.DataFrame(image_features[0].reshape(1, -1))
|
| 30 |
-
quality_score = predictor.predict(input_df).iloc[0]
|
| 31 |
|
| 32 |
logger.info(f"decision: {quality_score}")
|
| 33 |
decision_json = json.dumps({"quality_score": quality_score}).encode("utf-8")
|
|
@@ -40,18 +40,8 @@ iface = gr.Interface(
|
|
| 40 |
inputs="image",
|
| 41 |
outputs="text",
|
| 42 |
description="""
|
| 43 |
-
The model returns
|
| 44 |
-
probability > 0.9, the image can be automatically tagged as a base body. If
|
| 45 |
-
probability < 0.2, the image can be automatically REJECTED as NOT as base
|
| 46 |
-
body. All other cases will be submitted for moderation.
|
| 47 |
-
|
| 48 |
-
Please flag if you think the decision is wrong.
|
| 49 |
""",
|
| 50 |
allow_flagging="manual",
|
| 51 |
-
flagging_options=[
|
| 52 |
-
": decision should be accept",
|
| 53 |
-
": decision should be reject",
|
| 54 |
-
": decision should be moderation",
|
| 55 |
-
],
|
| 56 |
)
|
| 57 |
iface.launch()
|
|
|
|
| 27 |
with torch.no_grad():
|
| 28 |
image_features = clip_model.encode_image(image).numpy()
|
| 29 |
input_df = pd.DataFrame(image_features[0].reshape(1, -1))
|
| 30 |
+
quality_score = float(predictor.predict(input_df).iloc[0])
|
| 31 |
|
| 32 |
logger.info(f"decision: {quality_score}")
|
| 33 |
decision_json = json.dumps({"quality_score": quality_score}).encode("utf-8")
|
|
|
|
| 40 |
inputs="image",
|
| 41 |
outputs="text",
|
| 42 |
description="""
|
| 43 |
+
The model returns quality score for an avatar based on visual apeal and humanoid appearance.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
""",
|
| 45 |
allow_flagging="manual",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
)
|
| 47 |
iface.launch()
|