esteele commited on
Commit
b3f9a9b
·
1 Parent(s): 843798d

test with ml

Browse files
Files changed (2) hide show
  1. app.py +52 -24
  2. requirements.txt +2 -1
app.py CHANGED
@@ -1,7 +1,9 @@
1
  import gradio as gr
 
 
2
  # from huggingface_hub import InferenceClient
3
  # API_URL = "https://api-inference.huggingface.co/models/esteele/carlas-loan-classifier-model"
4
- # client = InferenceClient("esteele/carlas-loan-classifier-model")
5
  #
6
 
7
  def greet(name):
@@ -11,29 +13,55 @@ def greet(name):
11
  inface = gr.Interface(fn=greet, inputs="text", outputs="text")
12
  inface.launch()
13
 
14
- # def predict(a,b,c,d,e):
15
- #
16
- # payload = {"inputs":[[a,b,c,d,e]]}
17
- # response = client.post(json=payload)
18
- #
19
- # # r = requests.post(client, json=payload)
20
- #
21
- # return response
22
- #
23
- #
24
- #
25
- # with gr.Blocks() as demo:
26
- #
27
- # gr.Markdown("# Loan Status Classifier")
28
- #
29
- # a = gr.Slider(1000,100000,label="Loan Amount")
30
- # b = gr.Slider(100,2000,label="Credit Score")
31
- # c = gr.Slider(1000,100000,label="Income")
32
- # d = gr.Slider(0,1000,label="Investors")
33
- # e = gr.Slider(20,5000,label="Monthly Payment")
 
34
  #
35
- # output = gr.Textbox()
36
  #
37
- # btn = gr.Button("Predict")
38
  #
39
- # btn.click(predict,[a,b,c,d,e],output)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from huggingface_hub import InferenceClient
3
+
4
  # from huggingface_hub import InferenceClient
5
  # API_URL = "https://api-inference.huggingface.co/models/esteele/carlas-loan-classifier-model"
6
+ client = InferenceClient("esteele/carlas-loan-classifier-model")
7
  #
8
 
9
  def greet(name):
 
13
  inface = gr.Interface(fn=greet, inputs="text", outputs="text")
14
  inface.launch()
15
 
16
+ def predict(
17
+ loan_original_amount,
18
+ credit_score_range_lower,
19
+ stated_monthly_income,
20
+ investors,
21
+ monthly_loan_payment,):
22
+
23
+ input_dict = {
24
+ 'LoanOriginalAmount': loan_original_amount,
25
+ 'CreditScoreRangeLower': credit_score_range_lower,
26
+ 'StatedMonthlyIncome': stated_monthly_income,
27
+ 'Investors': investors,
28
+ 'MonthlyLoanPayment': monthly_loan_payment,
29
+
30
+ }
31
+
32
+ response = client.post(input_dict)
33
+
34
+ # r = requests.post(client, json=payload)
35
+
36
+ return response
37
  #
 
38
  #
 
39
  #
40
+ with gr.Blocks() as demo:
41
+
42
+ gr.Markdown("# Loan Status Classifier")
43
+
44
+ inputs = [
45
+ gr.Slider(1000, 100000, label="Loan Original Amount"),
46
+ gr.Slider(100, 2000, step=1, label='Credit Score Range (Lower)'),
47
+ gr.Slider(1000, 100000, step=10, label="Stated Monthly Income"),
48
+ gr.Slider(0, 1000, step=1, label='Number of Investors'),
49
+ gr.Slider(20, 5000, step=5, label="Monthly Loan Payment")
50
+
51
+ ]
52
+
53
+ # a = gr.Slider(1000,100000,label="Loan Amount")
54
+ # b = gr.Slider(100,2000,label="Credit Score")
55
+ # c = gr.Slider(1000,100000,label="Income")
56
+ # d = gr.Slider(0,1000,label="Investors")
57
+ # e = gr.Slider(20,5000,label="Monthly Payment")
58
+
59
+ output = gr.Textbox()
60
+
61
+ btn = gr.Button("Predict")
62
+
63
+ # btn.click(predict,[inputs],output)
64
+
65
+ gr.Interface(fn=predict, inputs=inputs, outputs=output)
66
+
67
+ demo.launch()
requirements.txt CHANGED
@@ -1,2 +1,3 @@
1
  gradio
2
- huggingface_hub
 
 
1
  gradio
2
+ huggingface_hub
3
+ pandas