Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
def prediction(text):
|
| 3 |
+
text_processed=(preprocess_nltk(text))
|
| 4 |
+
ans=pipe2.predict([text_processed])
|
| 5 |
+
classes = ['Irrelevant', 'Natural', 'Negative', 'Positive']
|
| 6 |
+
predicted_label = ans[0]
|
| 7 |
+
return(f"The above text is:{classes[predicted_label]}" )
|
| 8 |
+
|
| 9 |
+
pre = gr.Interface(
|
| 10 |
+
fn=prediction,
|
| 11 |
+
inputs=["text"],
|
| 12 |
+
outputs=[gr.Textbox(label="Prediction", lines=3)],
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
pre.launch()
|