Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# تحميل النموذج
|
5 |
+
classifier = pipeline("text-classification", model="distilbert-base-uncased")
|
6 |
+
|
7 |
+
# عنوان التطبيق
|
8 |
+
st.title("Text Classification App")
|
9 |
+
|
10 |
+
# إدخال النص
|
11 |
+
text = st.text_area("Enter your text here:")
|
12 |
+
|
13 |
+
# زر التصنيف
|
14 |
+
if st.button("Classify"):
|
15 |
+
if text:
|
16 |
+
result = classifier(text)
|
17 |
+
label = result[0]['label']
|
18 |
+
st.write(f"Classification Result: {label}")
|
19 |
+
else:
|
20 |
+
st.warning("Please enter some text!")
|