Klaus04 commited on
Commit
7e76d84
·
verified ·
1 Parent(s): 54dbb4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
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
- tweet = gr.Textbox(placeholder="Enter your tweet here")
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