pgurazada1
commited on
Commit
•
f0d402f
1
Parent(s):
5f2fc3b
Update app.py
Browse files
app.py
CHANGED
@@ -32,7 +32,7 @@ report_input = gr.Dropdown(['GIA', 'IGI', 'HRD', 'AGS'], label="Report")
|
|
32 |
type_input = gr.Dropdown(['Natural', 'Lab Grown'], label="Type")
|
33 |
|
34 |
hf_token = os.environ["HF_TOKEN"]
|
35 |
-
hf_writer = gr.HuggingFaceDatasetSaver(hf_token, "diamond-price-
|
36 |
|
37 |
model_output = gr.Label(label="Predicted Price")
|
38 |
|
@@ -50,14 +50,15 @@ def predict_price(carat, shape, cut, color, clarity, report, type):
|
|
50 |
prediction = price_predictor.predict(data_point).tolist()
|
51 |
return prediction[0]
|
52 |
|
53 |
-
demo = gr.Interface(
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
|
|
61 |
)
|
62 |
|
63 |
demo.queue(concurrency_count=8)
|
|
|
32 |
type_input = gr.Dropdown(['Natural', 'Lab Grown'], label="Type")
|
33 |
|
34 |
hf_token = os.environ["HF_TOKEN"]
|
35 |
+
hf_writer = gr.HuggingFaceDatasetSaver(hf_token, "diamond-price-prediction-logs")
|
36 |
|
37 |
model_output = gr.Label(label="Predicted Price")
|
38 |
|
|
|
50 |
prediction = price_predictor.predict(data_point).tolist()
|
51 |
return prediction[0]
|
52 |
|
53 |
+
demo = gr.Interface(
|
54 |
+
fn=predict_price,
|
55 |
+
inputs=[carat_input, shape_input, cut_input, color_input,
|
56 |
+
clarity_input, report_input, type_input],
|
57 |
+
outputs=model_output,
|
58 |
+
title="Diamond Price Predictor",
|
59 |
+
description="This API allows you to predict the price of a diamond given its attributes",
|
60 |
+
allow_flagging="manual",
|
61 |
+
flagging_callback=hf_writer
|
62 |
)
|
63 |
|
64 |
demo.queue(concurrency_count=8)
|