Alshargi commited on
Commit
e21a911
·
verified ·
1 Parent(s): e5365df

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -18
app.py CHANGED
@@ -79,32 +79,24 @@ def prepare_text(text):
79
 
80
 
81
 
 
82
  from transformers import pipeline
83
 
84
  # Load the model using the Hugging Face model hub
85
  model = pipeline("text-classification", model="Alshargi/arabic-msa-dialects-segmentation")
86
 
87
-
88
-
89
  # Slider to select a value
90
- x = st.slider('Select a value')
91
-
92
-
93
- themaxres = x
94
- dd = x.replace("،", "")
95
- dd = dd.replace("؟", "")
96
-
97
- gg = word_tokenize(dd)
98
- result = model([features(gg, index) for index in range(len(gg))])
99
-
100
-
101
- cc = ""
102
- for x, y in zip(gg, result):
103
- cc += rebuildxx(x, y) + " "
104
 
 
 
 
 
105
 
106
- # Display the prediction
107
- st.write("Prediction:", cc)
 
 
108
 
109
 
110
 
 
79
 
80
 
81
 
82
+ import streamlit as st
83
  from transformers import pipeline
84
 
85
  # Load the model using the Hugging Face model hub
86
  model = pipeline("text-classification", model="Alshargi/arabic-msa-dialects-segmentation")
87
 
 
 
88
  # Slider to select a value
89
+ x = st.text_input('Enter a text')
 
 
 
 
 
 
 
 
 
 
 
 
 
90
 
91
+ # Check if text input is not empty
92
+ if x:
93
+ # Make prediction using the loaded model
94
+ result = model(x)
95
 
96
+ # Display the prediction
97
+ st.write("Prediction:", result)
98
+ else:
99
+ st.write("Please enter some text.")
100
 
101
 
102