Ozgur Unlu commited on
Commit
052a382
β€’
1 Parent(s): 62a1dcb

UI changesi still on CPU

Browse files
Files changed (1) hide show
  1. interface.py +59 -27
interface.py CHANGED
@@ -2,36 +2,68 @@ import gradio as gr
2
  from analyzer import analyze_ad_copy
3
 
4
  def create_interface():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  demo = gr.Interface(
6
  fn=analyze_ad_copy,
7
- inputs=gr.Image(
8
- type="numpy",
9
- label="Upload Marketing Material",
10
- height=300,
11
- width=400,
12
- ),
13
- outputs=gr.HTML(
14
- label="Compliance Report",
15
- ),
 
 
 
 
 
16
  title="Marketing Campaign Compliance Checker",
17
  description="Upload marketing material to check compliance with US (SEC), UK (FCA), and EU financial regulations.",
18
- theme=gr.themes.Default(),
19
- css="""
20
- .report-container { font-family: 'Arial', sans-serif; padding: 20px; }
21
- .status { font-size: 1.2em; margin-bottom: 20px; padding: 10px; border-radius: 5px; }
22
- .compliant { background-color: #e7f5e7; color: #0d5f0d; }
23
- .non-compliant { background-color: #fce8e8; color: #c41e3a; }
24
- .section { margin: 15px 0; }
25
- .section-title { font-weight: bold; color: #2c3e50; margin: 10px 0; }
26
- .item { margin: 5px 0 5px 20px; }
27
- .severity-high { color: #c41e3a; }
28
- .severity-medium { color: #f39c12; }
29
- .severity-low { color: #27ae60; }
30
- .risk-high { background-color: #fce8e8; }
31
- .risk-medium { background-color: #fff3cd; }
32
- .risk-low { background-color: #e7f5e7; }
33
- .channel { margin: 10px 0; padding: 10px; border-radius: 5px; }
34
- .details { margin-left: 20px; font-size: 0.9em; color: #555; }
35
- """
36
  )
37
  return demo
 
2
  from analyzer import analyze_ad_copy
3
 
4
  def create_interface():
5
+ css = """
6
+ .report-container { font-family: 'Arial', sans-serif; padding: 20px; }
7
+ .status { font-size: 1.2em; margin-bottom: 20px; padding: 10px; border-radius: 5px; }
8
+ .compliant { background-color: #e7f5e7; color: #0d5f0d; }
9
+ .non-compliant { background-color: #fce8e8; color: #c41e3a; }
10
+ .section { margin: 15px 0; }
11
+ .section-title { font-weight: bold; color: #2c3e50; margin: 10px 0; }
12
+ .item { margin: 5px 0 5px 20px; }
13
+ .severity-high { color: #c41e3a; }
14
+ .severity-medium { color: #f39c12; }
15
+ .severity-low { color: #27ae60; }
16
+ .risk-high { background-color: #fce8e8; }
17
+ .risk-medium { background-color: #fff3cd; }
18
+ .risk-low { background-color: #e7f5e7; }
19
+ .channel { margin: 10px 0; padding: 10px; border-radius: 5px; }
20
+ .details { margin-left: 20px; font-size: 0.9em; color: #555; }
21
+ .placeholder {
22
+ padding: 20px;
23
+ background-color: #f8f9fa;
24
+ border: 1px dashed #dee2e6;
25
+ border-radius: 5px;
26
+ color: #6c757d;
27
+ text-align: center;
28
+ }
29
+ """
30
+
31
+ # Create a placeholder HTML
32
+ placeholder_html = """
33
+ <div class="report-container">
34
+ <div class="placeholder">
35
+ <h3>πŸ“‹ Compliance Report Will Appear Here</h3>
36
+ <p>Upload a marketing material image and click "Submit" to analyze compliance with financial regulations.</p>
37
+ <p>The report will check:</p>
38
+ <ul style="list-style-type: none; padding: 0;">
39
+ <li>βœ“ Prohibited financial terms</li>
40
+ <li>βœ“ Required disclaimers</li>
41
+ <li>βœ“ Multi-region compliance</li>
42
+ <li>βœ“ Channel-specific risks</li>
43
+ </ul>
44
+ </div>
45
+ </div>
46
+ """
47
+
48
  demo = gr.Interface(
49
  fn=analyze_ad_copy,
50
+ inputs=[
51
+ gr.Image(
52
+ type="numpy",
53
+ label="Upload Marketing Material",
54
+ height=300,
55
+ width=400
56
+ )
57
+ ],
58
+ outputs=[
59
+ gr.HTML(
60
+ label="Compliance Report",
61
+ value=placeholder_html # Set the initial placeholder
62
+ )
63
+ ],
64
  title="Marketing Campaign Compliance Checker",
65
  description="Upload marketing material to check compliance with US (SEC), UK (FCA), and EU financial regulations.",
66
+ css=css,
67
+ theme=gr.themes.Default()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  )
69
  return demo