Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,9 +52,16 @@ def predict(tweet,freqs=freqs):
|
|
| 52 |
res = model.predict(x)
|
| 53 |
if (res==0): return "Negative comment"
|
| 54 |
else: return "Positive comment"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
-
|
| 57 |
-
int = gr.Interface(fn = predict, inputs = tweet, outputs = "textbox").launch(share = True)
|
| 58 |
|
| 59 |
|
| 60 |
|
|
|
|
| 52 |
res = model.predict(x)
|
| 53 |
if (res==0): return "Negative comment"
|
| 54 |
else: return "Positive comment"
|
| 55 |
+
with gr.Blocks() as demo:
|
| 56 |
+
Tweet = gr.Textbox(label = "Tweet",placeholder="Enter your tweet here")
|
| 57 |
+
out = gr.Textbox(label = "Sentiment")
|
| 58 |
+
with gr.Row():
|
| 59 |
+
gr.Markdown("## Text examples")
|
| 60 |
+
gr.Examples(["I am not good", "I am :)", "it is bad"], inputs = Tweet, outputs=out,fn = predict)
|
| 61 |
+
btn = gr.Button(value= "Submit")
|
| 62 |
+
btn.click(fn = predict, inputs = Tweet, outputs = out)
|
| 63 |
|
| 64 |
+
demo.launch()
|
|
|
|
| 65 |
|
| 66 |
|
| 67 |
|