DemahAlmutairi commited on
Commit
cb7b592
·
verified ·
1 Parent(s): f4ab359

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -3
app.py CHANGED
@@ -22,11 +22,53 @@ def analyze_sentiment(text, language):
22
  arabic_label = arabic_labels.get(label, "غير معروف") # Default to "Unknown" if label not found
23
  return arabic_label, result[0]['score']
24
 
25
- # Create Gradio interface
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  iface = gr.Interface(
27
  fn=analyze_sentiment,
28
  inputs=[
29
- gr.Textbox(label="Enter text"),
30
  gr.Radio(choices=["English", "Arabic"], label="Select Language")
31
  ],
32
  outputs=[
@@ -40,7 +82,8 @@ iface = gr.Interface(
40
  ["This is the worst experience I've ever had.", "English"],
41
  ["أنا سعيد جدًا بهذا!", "Arabic"],
42
  ["هذا المكان سيء للغاية.", "Arabic"]
43
- ]
 
44
  )
45
 
46
  iface.launch()
 
22
  arabic_label = arabic_labels.get(label, "غير معروف") # Default to "Unknown" if label not found
23
  return arabic_label, result[0]['score']
24
 
25
+ # Create Gradio interface with custom CSS
26
+ css = """
27
+ body {
28
+ background-color: #f4f7f6;
29
+ font-family: 'Arial', sans-serif;
30
+ }
31
+
32
+ h1, h2 {
33
+ color: #3e606f;
34
+ }
35
+
36
+ .gradio-container {
37
+ border-radius: 10px;
38
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
39
+ }
40
+
41
+ input, select, textarea {
42
+ border: 1px solid #3e606f;
43
+ border-radius: 5px;
44
+ padding: 10px;
45
+ margin-bottom: 10px;
46
+ width: 100%;
47
+ }
48
+
49
+ button {
50
+ background-color: #3e606f;
51
+ color: white;
52
+ border: none;
53
+ border-radius: 5px;
54
+ padding: 10px 15px;
55
+ cursor: pointer;
56
+ }
57
+
58
+ button:hover {
59
+ background-color: #2c4d4f;
60
+ }
61
+
62
+ .result {
63
+ font-weight: bold;
64
+ color: #3e606f;
65
+ }
66
+ """
67
+
68
  iface = gr.Interface(
69
  fn=analyze_sentiment,
70
  inputs=[
71
+ gr.Textbox(label="Enter text", placeholder="Type your text here..."),
72
  gr.Radio(choices=["English", "Arabic"], label="Select Language")
73
  ],
74
  outputs=[
 
82
  ["This is the worst experience I've ever had.", "English"],
83
  ["أنا سعيد جدًا بهذا!", "Arabic"],
84
  ["هذا المكان سيء للغاية.", "Arabic"]
85
+ ],
86
+ css=css # Add custom CSS here
87
  )
88
 
89
  iface.launch()