kxshrx commited on
Commit
961d809
·
verified ·
1 Parent(s): 921b643

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # This is the key line:
5
+ # It loads your private model from your *other* repository.
6
+ pipe = pipeline(
7
+ "text-classification",
8
+ model="kxshrx/infrnce-bert-classifier"
9
+ )
10
+
11
+ def classify_log(log_text):
12
+ # This function runs the classification.
13
+ results = pipe(log_text, top_k=None)
14
+ # We format the result into a simple dictionary.
15
+ return {item['label']: item['score'] for item in results[0]}
16
+
17
+ # This creates a simple web UI for testing and, more importantly,
18
+ # an API endpoint that we can call.
19
+ gr.Interface(
20
+ fn=classify_log,
21
+ inputs=gr.Textbox(lines=5, label="Log Entry"),
22
+ outputs=gr.Label(num_top_classes=6),
23
+ title="Infrnce Private Log Classifier API"
24
+ ).launch()