pgurazada1 commited on
Commit
1403624
1 Parent(s): 7e859cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import joblib
2
 
3
  import gradio as gr
@@ -30,6 +31,9 @@ clarity_input = gr.Dropdown(
30
  report_input = gr.Dropdown(['GIA', 'IGI', 'HRD', 'AGS'], label="Report")
31
  type_input = gr.Dropdown(['Natural', 'Lab Grown'], label="Type")
32
 
 
 
 
33
  model_output = gr.Label(label="Predicted Price")
34
 
35
  def predict_price(carat, shape, cut, color, clarity, report, type):
@@ -53,7 +57,9 @@ demo = gr.Interface(fn=predict_price,
53
  title="Diamond Price Predictor",
54
  description="This API allows you to predict the price of a diamond given its attributes",
55
  allow_flagging="manual",
56
- flagging_options=["Incorrect", "Correct"])
 
 
57
 
58
  demo.queue(concurrency_count=8)
59
  demo.launch(share=False)
 
1
+ import os
2
  import joblib
3
 
4
  import gradio as gr
 
31
  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, "pgurazada1/diamond-price-predictor-logs")
36
+
37
  model_output = gr.Label(label="Predicted Price")
38
 
39
  def predict_price(carat, shape, cut, color, clarity, report, type):
 
57
  title="Diamond Price Predictor",
58
  description="This API allows you to predict the price of a diamond given its attributes",
59
  allow_flagging="manual",
60
+ flagging_options=["Incorrect", "Correct"],
61
+ flagging_callback=hf_writer
62
+ )
63
 
64
  demo.queue(concurrency_count=8)
65
  demo.launch(share=False)