Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load the fine-tuned model from Hugging Face Hub
|
5 |
+
classifier = pipeline("text-classification", model="Emanai/my-finetuned-bert2")
|
6 |
+
|
7 |
+
def classify_text(text):
|
8 |
+
return classifier(text)[0]
|
9 |
+
|
10 |
+
# Create a simple Gradio interface
|
11 |
+
iface = gr.Interface(fn=classify_text, inputs="text", outputs="label")
|
12 |
+
|
13 |
+
# Launch the Gradio app
|
14 |
+
iface.launch()
|