Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,9 @@ from transformers import TFAutoModelForSequenceClassification
|
|
| 10 |
model = TFAutoModelForSequenceClassification.from_pretrained("ilan541/OncUponTim")
|
| 11 |
|
| 12 |
def predict(your_text):
|
|
|
|
|
|
|
|
|
|
| 13 |
inp = tokenizer(your_text, return_tensors='tf')
|
| 14 |
if np.argmax(softmax(model(inp).logits)) == 0:
|
| 15 |
return 'This content is not of high standard. It needs editing. '
|
|
@@ -17,7 +20,6 @@ def predict(your_text):
|
|
| 17 |
return 'Promising content! Our algorithm predicts it will be very popular.'
|
| 18 |
|
| 19 |
|
| 20 |
-
##### add possibility to play with the threshold
|
| 21 |
|
| 22 |
iface = gr.Interface(fn=predict, inputs="text", outputs="text")
|
| 23 |
iface.launch()
|
|
|
|
| 10 |
model = TFAutoModelForSequenceClassification.from_pretrained("ilan541/OncUponTim")
|
| 11 |
|
| 12 |
def predict(your_text):
|
| 13 |
+
# split the text
|
| 14 |
+
|
| 15 |
+
# inference
|
| 16 |
inp = tokenizer(your_text, return_tensors='tf')
|
| 17 |
if np.argmax(softmax(model(inp).logits)) == 0:
|
| 18 |
return 'This content is not of high standard. It needs editing. '
|
|
|
|
| 20 |
return 'Promising content! Our algorithm predicts it will be very popular.'
|
| 21 |
|
| 22 |
|
|
|
|
| 23 |
|
| 24 |
iface = gr.Interface(fn=predict, inputs="text", outputs="text")
|
| 25 |
iface.launch()
|