Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -164,56 +164,56 @@ def predict_fraud(transaction: Transaction):
|
|
| 164 |
#if __name__ == "__main__":
|
| 165 |
# import uvicorn
|
| 166 |
# uvicorn.run(app, host="0.0.0.0", port=7860)
|
| 167 |
-
if __name__ == "__main__":
|
| 168 |
-
|
| 169 |
-
|
| 170 |
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
|
| 218 |
-
|
| 219 |
-
|
|
|
|
| 164 |
#if __name__ == "__main__":
|
| 165 |
# import uvicorn
|
| 166 |
# uvicorn.run(app, host="0.0.0.0", port=7860)
|
| 167 |
+
# if __name__ == "__main__":
|
| 168 |
+
# import gradio as gr
|
| 169 |
+
# from app import predict_fraud, Transaction # si tu es déjà dans app.py, inutile de réimporter
|
| 170 |
|
| 171 |
+
# # Wrapper pour adapter les inputs de Gradio au modèle FastAPI
|
| 172 |
+
# def api_predict_wrapper(
|
| 173 |
+
# amt, category, merchant, trans_date_trans_time, gender, state,
|
| 174 |
+
# lat, long, city_pop, dob, merch_lat, merch_long,
|
| 175 |
+
# cc_num=None, avg_amt=50, std_amt=30, nb_trans=10
|
| 176 |
+
# ):
|
| 177 |
+
# tx = Transaction(
|
| 178 |
+
# amt=amt,
|
| 179 |
+
# category=category,
|
| 180 |
+
# merchant=merchant,
|
| 181 |
+
# trans_date_trans_time=trans_date_trans_time,
|
| 182 |
+
# gender=gender,
|
| 183 |
+
# state=state,
|
| 184 |
+
# lat=lat,
|
| 185 |
+
# long=long,
|
| 186 |
+
# city_pop=city_pop,
|
| 187 |
+
# dob=dob,
|
| 188 |
+
# merch_lat=merch_lat,
|
| 189 |
+
# merch_long=merch_long,
|
| 190 |
+
# cc_num=cc_num,
|
| 191 |
+
# avg_amt=avg_amt,
|
| 192 |
+
# std_amt=std_amt,
|
| 193 |
+
# nb_trans=nb_trans
|
| 194 |
+
# )
|
| 195 |
+
# result = predict_fraud(tx)
|
| 196 |
+
# return result.dict()
|
| 197 |
|
| 198 |
+
# # Définition de l'interface Gradio
|
| 199 |
+
# iface = gr.Interface(
|
| 200 |
+
# fn=api_predict_wrapper,
|
| 201 |
+
# inputs=[
|
| 202 |
+
# gr.Number(label="Montant"),
|
| 203 |
+
# gr.Textbox(label="Catégorie"),
|
| 204 |
+
# gr.Textbox(label="Marchand"),
|
| 205 |
+
# gr.Textbox(label="Date/Heure"),
|
| 206 |
+
# gr.Textbox(label="Genre"),
|
| 207 |
+
# gr.Textbox(label="État"),
|
| 208 |
+
# gr.Number(label="Latitude"),
|
| 209 |
+
# gr.Number(label="Longitude"),
|
| 210 |
+
# gr.Number(label="Population ville"),
|
| 211 |
+
# gr.Textbox(label="Date de naissance"),
|
| 212 |
+
# gr.Number(label="Lat march."),
|
| 213 |
+
# gr.Number(label="Long march."),
|
| 214 |
+
# ],
|
| 215 |
+
# outputs=gr.JSON(label="Résultat")
|
| 216 |
+
# )
|
| 217 |
|
| 218 |
+
# # Lancement du front Gradio
|
| 219 |
+
# iface.launch()
|