heeba001 commited on
Commit
65eed59
·
verified ·
1 Parent(s): 6558f64

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from bertopic import BERTopic
2
+ import gradio as gr
3
+
4
+ # Load your trained topic model
5
+ model = BERTopic.load("topic_model")
6
+
7
+ def predict_topic(text):
8
+ topics, _ = model.transform([text])
9
+ return str(topics[0])
10
+
11
+ iface = gr.Interface(
12
+ fn=predict_topic,
13
+ inputs=gr.Textbox(label="Enter text"),
14
+ outputs=gr.Textbox(label="Predicted Topic"),
15
+ title="AFCON Topic Detection"
16
+ )
17
+
18
+ iface.launch()