Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,13 @@ import joblib
|
|
3 |
import numpy as np
|
4 |
import pandas as pd
|
5 |
from openai import OpenAI
|
|
|
6 |
from huggingface_hub import hf_hub_download
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
# Load your pre-trained model and label names
|
9 |
model_path = hf_hub_download(repo_id="govtech/zoo-entry-001", filename="model.joblib")
|
@@ -45,6 +51,7 @@ def classify_text(text):
|
|
45 |
'Prediction': (probabilities[0] > 0.5).astype(int)
|
46 |
})
|
47 |
# Return an update to the DataFrame component to make it visible with the results
|
|
|
48 |
return gr.update(value=df, visible=True)
|
49 |
|
50 |
with gr.Blocks(title="Zoo Entry 001") as iface:
|
|
|
3 |
import numpy as np
|
4 |
import pandas as pd
|
5 |
from openai import OpenAI
|
6 |
+
from huggingface_hub import login
|
7 |
from huggingface_hub import hf_hub_download
|
8 |
+
import logfire
|
9 |
+
|
10 |
+
login()
|
11 |
+
|
12 |
+
logfire.configure(token=os.getenv("LOGFIRE_API_KEY"))
|
13 |
|
14 |
# Load your pre-trained model and label names
|
15 |
model_path = hf_hub_download(repo_id="govtech/zoo-entry-001", filename="model.joblib")
|
|
|
51 |
'Prediction': (probabilities[0] > 0.5).astype(int)
|
52 |
})
|
53 |
# Return an update to the DataFrame component to make it visible with the results
|
54 |
+
logfire.info(f"{text} ({probabilities[0]})")
|
55 |
return gr.update(value=df, visible=True)
|
56 |
|
57 |
with gr.Blocks(title="Zoo Entry 001") as iface:
|