Abhishek0323 commited on
Commit
6ba6745
1 Parent(s): fdc936d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -14
app.py CHANGED
@@ -16,26 +16,14 @@ def predict_sentiment(text):
16
  result = {sentiments[i]: float(predictions[0][i]) for i in range(len(sentiments))}
17
  return result
18
 
19
- def custom_theme():
20
- """Define a custom theme for the Gradio app."""
21
- return gr.Theme(
22
- # Define your color scheme
23
- primary='#FF6347',
24
- text_on_primary='#FFFFFF',
25
- background='#F0F8FF',
26
- card_background='#FAEBD7',
27
- text='#2F4F4F',
28
- icon='light',
29
- )
30
-
31
  # Create Gradio interface
32
  iface = gr.Interface(fn=predict_sentiment,
33
  inputs=gr.Textbox(lines=2, placeholder="Type your sentence here..."),
34
  outputs=gr.Label(),
35
- theme=custom_theme(),
36
  title="Sentiment Analysis",
37
  description="Analyze the sentiment of your text. Powered by CardiffNLP's RoBERTa model.",
38
- article="<p style='text-align: center'>Enter a sentence to get its sentiment. The model categorizes sentiments into Negative, Neutral, and Positive.</p>")
 
39
 
40
  if __name__ == "__main__":
41
  iface.launch()
 
16
  result = {sentiments[i]: float(predictions[0][i]) for i in range(len(sentiments))}
17
  return result
18
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  # Create Gradio interface
20
  iface = gr.Interface(fn=predict_sentiment,
21
  inputs=gr.Textbox(lines=2, placeholder="Type your sentence here..."),
22
  outputs=gr.Label(),
 
23
  title="Sentiment Analysis",
24
  description="Analyze the sentiment of your text. Powered by CardiffNLP's RoBERTa model.",
25
+ article="<p style='text-align: center'>Enter a sentence to get its sentiment. The model categorizes sentiments into Negative, Neutral, and Positive.</p>",
26
+ theme="huggingface") # Using a built-in theme
27
 
28
  if __name__ == "__main__":
29
  iface.launch()