Add feedback writer
Browse files
app.py
CHANGED
@@ -15,8 +15,14 @@ CLIP_MODEL_NAME = "ViT-B/16"
|
|
15 |
TEXT_PROMPTS_FILE_NAME = "text_prompts.json"
|
16 |
LOGISTIC_REGRESSION_MODEL_FILE_NAME = "logistic_regression_l1_oct_2.pkl"
|
17 |
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
clip_model, preprocess = clip.load(
|
|
|
|
|
20 |
|
21 |
with open(
|
22 |
os.path.join(os.path.dirname(__file__), TEXT_PROMPTS_FILE_NAME), "r"
|
@@ -74,6 +80,7 @@ iface = gr.Interface(
|
|
74 |
fn=predict_fn,
|
75 |
inputs="image",
|
76 |
outputs="text",
|
77 |
-
allow_flagging="manual"
|
|
|
78 |
)
|
79 |
iface.launch()
|
|
|
15 |
TEXT_PROMPTS_FILE_NAME = "text_prompts.json"
|
16 |
LOGISTIC_REGRESSION_MODEL_FILE_NAME = "logistic_regression_l1_oct_2.pkl"
|
17 |
|
18 |
+
HF_TOKEN = os.getenv('HF_TOKEN')
|
19 |
+
hf_writer = gr.HuggingFaceDatasetSaver(
|
20 |
+
HF_TOKEN, "Roblox/basebody_feedback"
|
21 |
+
)
|
22 |
|
23 |
+
clip_model, preprocess = clip.load(
|
24 |
+
CLIP_MODEL_NAME, device="cpu"
|
25 |
+
)
|
26 |
|
27 |
with open(
|
28 |
os.path.join(os.path.dirname(__file__), TEXT_PROMPTS_FILE_NAME), "r"
|
|
|
80 |
fn=predict_fn,
|
81 |
inputs="image",
|
82 |
outputs="text",
|
83 |
+
allow_flagging="manual",
|
84 |
+
flagging_callback=hf_writer
|
85 |
)
|
86 |
iface.launch()
|