Spaces:
Runtime error
Runtime error
Nathanotal
commited on
Commit
·
83c39e6
1
Parent(s):
a3e1d9e
pricefix
Browse files
app.py
CHANGED
@@ -51,8 +51,7 @@ topAgencies = ['Fastighetsbyrån','Notar','Svensk Fastighetsförmedling','Husman
|
|
51 |
|
52 |
def downloadAutogluonModel():
|
53 |
# Download saved Autogluon model from Hopsworks
|
54 |
-
project = hopsworks.login(
|
55 |
-
api_key_value='OWXnoeaQ1Bg6I0IE.EgaQo2HmubMIzfChCahCK6sQVLs4vyrhj2ODWHcYr0RN9f1gqac2dJjn8p2fXwcQ') # TODO: Remove, lol
|
56 |
mr = project.get_model_registry()
|
57 |
temp = mr.get_model("ag_model_20230109", version=5)
|
58 |
temp_ag_folder_path = temp.download()
|
@@ -72,7 +71,7 @@ def moveFolder(temp_ag_folder_path):
|
|
72 |
|
73 |
def downloadModel():
|
74 |
# Download saved Autogluon model from Hopsworks
|
75 |
-
project = hopsworks.login(
|
76 |
mr = project.get_model_registry()
|
77 |
temp = mr.get_model("xgboost_model", version=5)
|
78 |
model_path = temp.download()
|
@@ -293,7 +292,7 @@ def autoPred(df):
|
|
293 |
return res, agencyString
|
294 |
|
295 |
def parseAgencyResult(top3, meanPrice):
|
296 |
-
toReturn = '
|
297 |
toReturn += 'Top 5:\n'
|
298 |
for agency, result in top3:
|
299 |
diff = result - meanPrice
|
@@ -392,7 +391,7 @@ def sthlm(streetName, number, sqm, rooms, monthlyFee, monthlyCost, floor, yearBu
|
|
392 |
|
393 |
|
394 |
|
395 |
-
return f'Predicted price of the apartment {mainExplanation}: {parsePrice(mainPred)}',
|
396 |
|
397 |
|
398 |
|
@@ -413,7 +412,7 @@ for feature in numericalInputs:
|
|
413 |
inputs.append(gr.inputs.Checkbox( label='Use AutoGluon instead of XGBoost', default=False))
|
414 |
|
415 |
# Create the interface
|
416 |
-
resultOutputs = [gr.outputs.Label(label='Price if sold today'), gr.outputs.Textbox(label='If sold at a different time'), gr.outputs.Textbox(label='Best agencies to use'), gr.outputs.Textbox(label='Error')]
|
417 |
|
418 |
demo = gr.Interface(
|
419 |
fn=sthlm,
|
|
|
51 |
|
52 |
def downloadAutogluonModel():
|
53 |
# Download saved Autogluon model from Hopsworks
|
54 |
+
project = hopsworks.login()
|
|
|
55 |
mr = project.get_model_registry()
|
56 |
temp = mr.get_model("ag_model_20230109", version=5)
|
57 |
temp_ag_folder_path = temp.download()
|
|
|
71 |
|
72 |
def downloadModel():
|
73 |
# Download saved Autogluon model from Hopsworks
|
74 |
+
project = hopsworks.login()
|
75 |
mr = project.get_model_registry()
|
76 |
temp = mr.get_model("xgboost_model", version=5)
|
77 |
model_path = temp.download()
|
|
|
292 |
return res, agencyString
|
293 |
|
294 |
def parseAgencyResult(top3, meanPrice):
|
295 |
+
toReturn = 'To get the most money for your apartment, you should sell it with the help of one of these agencies:\n'
|
296 |
toReturn += 'Top 5:\n'
|
297 |
for agency, result in top3:
|
298 |
diff = result - meanPrice
|
|
|
391 |
|
392 |
|
393 |
|
394 |
+
return f'Predicted price of the apartment {mainExplanation}: {parsePrice(mainPred)}', '\n'.join(result), agencyInfo, ''
|
395 |
|
396 |
|
397 |
|
|
|
412 |
inputs.append(gr.inputs.Checkbox( label='Use AutoGluon instead of XGBoost', default=False))
|
413 |
|
414 |
# Create the interface
|
415 |
+
resultOutputs = [gr.outputs.Label(label='Price if sold today'), gr.outputs.Textbox(label='If sold at a different time'), gr.outputs.Textbox(label='Best agencies to use'), gr.outputs.Textbox(label='Error', type='error')]
|
416 |
|
417 |
demo = gr.Interface(
|
418 |
fn=sthlm,
|