Ifeanyi commited on
Commit
7aa9d48
Β·
verified Β·
1 Parent(s): 13c94ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +60 -26
app.py CHANGED
@@ -1,63 +1,97 @@
1
  import gradio as gr
2
  from synthscope import GoogleSearchImageGen
3
 
4
- with gr.Blocks(theme=gr.themes.Default(primary_hue="teal", secondary_hue="amber"),
 
 
 
 
 
 
 
 
 
 
 
 
5
  css="""
6
  footer {display: none !important;}
 
 
 
 
7
  .audio-container {
8
  padding: 10px;
9
  border-radius: 8px;
10
- background: rgba(0,0,0,0.02);
 
11
  }
12
  .audio-container audio {
13
  width: 100%;
14
  height: 60px;
15
  border-radius: 6px;
 
16
  }
17
  .output-section {
18
  margin-bottom: 20px;
19
  padding: 15px;
20
- border-radius: 20px;
21
- background: rgba(255,255,255,0.5);
22
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
 
 
23
  }
24
  .input-section {
25
  padding: 20px;
26
- background: rgba(0,150,136,0.05);
27
- border-radius: 20px;
 
28
  margin-top: 20px;
 
29
  }
30
  .section-title {
31
- color: #00695c;
32
  font-weight: bold;
33
  margin-bottom: 10px;
34
  font-size: 1.1em;
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
36
  """) as app:
37
-
38
- gr.HTML("<div style='text-align:center;overflow:hidden;padding:20px;'><h1 style='color:#00695c;'>🌐 SynthScope 🎨</h1><p style='color:#666;'>Search, Visualize, and Listen to Information</p></div>")
39
 
40
  # Output Section
41
  with gr.Column(elem_classes="output-section"):
42
  gr.HTML("<div class='section-title'>πŸ“Š Search Results</div>")
43
-
44
  # Text and Image in a row
45
  with gr.Row():
46
  with gr.Column(scale=1):
47
- gr.HTML("<h4 style='color:#00695c; margin-bottom:10px;'>πŸ“ Text Summary</h4>")
48
  text_output = gr.Markdown(height=320, container=True)
49
  with gr.Column(scale=1):
50
- gr.HTML("<h4 style='color:#00695c; margin-bottom:10px;'>🎨 Generated Image</h4>")
51
  image_output = gr.Image(label="", show_label=False, height=320, container=True)
52
 
53
  # Audio in its own row with proper spacing
54
  with gr.Row():
55
  with gr.Column():
56
- gr.HTML("<h4 style='color:#00695c; margin-bottom:10px;'>πŸ”Š Audio Narration</h4>")
57
  audio_output = gr.Audio(
58
- label="",
59
- type="filepath",
60
- show_label=False,
61
  elem_classes="audio-container",
62
  interactive=False
63
  )
@@ -65,11 +99,11 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="teal", secondary_hue="amber"
65
  # Input Section
66
  with gr.Column(elem_classes="input-section"):
67
  gr.HTML("<div class='section-title'>πŸ”§ Controls</div>")
68
-
69
  with gr.Row():
70
  with gr.Column(scale=2):
71
  text_input = gr.Textbox(
72
- label="πŸ” Search Query",
73
  placeholder="Enter your search query here...",
74
  lines=2
75
  )
@@ -78,24 +112,24 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="teal", secondary_hue="amber"
78
  label="πŸ‘€Select Voice",
79
  choices=["Kore", "Zephyr", "Orus", "Fenrir", "Charon", "Umbriel", "Schedar", "Iapetus", "Puck", "Gacrux"],
80
  value="Kore"
81
- )
82
  with gr.Column(scale=1):
83
  radio_input = gr.Radio(
84
  label="🎨 Image Style",
85
- choices=["Comic", "Cartoon", "3D", "Anime", "Ghibli", "Victorian", "Movie", "Star Wars", "Marvel"],
86
  value="Comic"
87
  )
88
 
89
  with gr.Row():
90
  with gr.Column(scale=1):
91
  btn = gr.Button(
92
- "πŸš€ Run SynthScope",
93
- variant="primary",
94
  size="lg"
95
  )
96
  with gr.Column(scale=1):
97
  clear_btn = gr.ClearButton(
98
- [text_input, radio_input, text_output, image_output, audio_output],
99
  value="πŸ—‘οΈ Clear All",
100
  variant="secondary",
101
  size="lg"
@@ -103,8 +137,8 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="teal", secondary_hue="amber"
103
 
104
  # Event handlers
105
  btn.click(
106
- fn=GoogleSearchImageGen,
107
- inputs=[text_input, radio_input, dropdown_input],
108
  outputs=[text_output, image_output, audio_output],
109
  show_progress=True
110
  )
 
1
  import gradio as gr
2
  from synthscope import GoogleSearchImageGen
3
 
4
+ with gr.Blocks(theme=gr.themes.Base(primary_hue="teal", secondary_hue="amber").set(
5
+ body_background_fill="*neutral_950",
6
+ body_text_color="*neutral_200",
7
+ background_fill_primary="*neutral_900",
8
+ background_fill_secondary="*neutral_800",
9
+ border_color_primary="*neutral_700",
10
+ block_background_fill="*neutral_900",
11
+ input_background_fill="*neutral_800",
12
+ button_primary_background_fill="*primary_600",
13
+ button_primary_background_fill_hover="*primary_700",
14
+ button_secondary_background_fill="*neutral_700",
15
+ button_secondary_background_fill_hover="*neutral_600"
16
+ ),
17
  css="""
18
  footer {display: none !important;}
19
+ body {
20
+ background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
21
+ color: #e2e8f0;
22
+ }
23
  .audio-container {
24
  padding: 10px;
25
  border-radius: 8px;
26
+ background: rgba(30, 41, 59, 0.8);
27
+ border: 1px solid rgba(100, 116, 139, 0.3);
28
  }
29
  .audio-container audio {
30
  width: 100%;
31
  height: 60px;
32
  border-radius: 6px;
33
+ background: #1e293b;
34
  }
35
  .output-section {
36
  margin-bottom: 20px;
37
  padding: 15px;
38
+ border-radius: 10px;
39
+ background: rgba(30, 41, 59, 0.6);
40
+ border: 1px solid rgba(100, 116, 139, 0.3);
41
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
42
+ backdrop-filter: blur(10px);
43
  }
44
  .input-section {
45
  padding: 20px;
46
+ background: rgba(15, 23, 42, 0.8);
47
+ border: 1px solid rgba(20, 184, 166, 0.3);
48
+ border-radius: 10px;
49
  margin-top: 20px;
50
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
51
  }
52
  .section-title {
53
+ color: #14b8a6;
54
  font-weight: bold;
55
  margin-bottom: 10px;
56
  font-size: 1.1em;
57
+ text-shadow: 0 0 10px rgba(20, 184, 166, 0.3);
58
+ }
59
+ h1 {
60
+ color: #14b8a6 !important;
61
+ text-shadow: 0 0 20px rgba(20, 184, 166, 0.4);
62
+ }
63
+ h4 {
64
+ color: #14b8a6 !important;
65
+ text-shadow: 0 0 10px rgba(20, 184, 166, 0.3);
66
+ }
67
+ .gradio-container {
68
+ background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%) !important;
69
  }
70
  """) as app:
71
+
72
+ gr.HTML("<div style='text-align:center;overflow:hidden;padding:20px;'><h1 style='color:#14b8a6;text-shadow: 0 0 20px rgba(20, 184, 166, 0.4);'>🌐 SynthScope πŸ‘€</h1><p style='color:#94a3b8;'>Search, Visualize, and Listen to Information</p></div>")
73
 
74
  # Output Section
75
  with gr.Column(elem_classes="output-section"):
76
  gr.HTML("<div class='section-title'>πŸ“Š Search Results</div>")
77
+
78
  # Text and Image in a row
79
  with gr.Row():
80
  with gr.Column(scale=1):
81
+ gr.HTML("<h4 style='color:#14b8a6; margin-bottom:10px; text-shadow: 0 0 10px rgba(20, 184, 166, 0.3);'>πŸ“ Text Summary</h4>")
82
  text_output = gr.Markdown(height=320, container=True)
83
  with gr.Column(scale=1):
84
+ gr.HTML("<h4 style='color:#14b8a6; margin-bottom:10px; text-shadow: 0 0 10px rgba(20, 184, 166, 0.3);'>🎨 Generated Image</h4>")
85
  image_output = gr.Image(label="", show_label=False, height=320, container=True)
86
 
87
  # Audio in its own row with proper spacing
88
  with gr.Row():
89
  with gr.Column():
90
+ gr.HTML("<h4 style='color:#14b8a6; margin-bottom:10px; text-shadow: 0 0 10px rgba(20, 184, 166, 0.3);'>πŸ”Š Audio Narration</h4>")
91
  audio_output = gr.Audio(
92
+ label="",
93
+ type="filepath",
94
+ show_label=False,
95
  elem_classes="audio-container",
96
  interactive=False
97
  )
 
99
  # Input Section
100
  with gr.Column(elem_classes="input-section"):
101
  gr.HTML("<div class='section-title'>πŸ”§ Controls</div>")
102
+
103
  with gr.Row():
104
  with gr.Column(scale=2):
105
  text_input = gr.Textbox(
106
+ label="πŸ” Search Query",
107
  placeholder="Enter your search query here...",
108
  lines=2
109
  )
 
112
  label="πŸ‘€Select Voice",
113
  choices=["Kore", "Zephyr", "Orus", "Fenrir", "Charon", "Umbriel", "Schedar", "Iapetus", "Puck", "Gacrux"],
114
  value="Kore"
115
+ )
116
  with gr.Column(scale=1):
117
  radio_input = gr.Radio(
118
  label="🎨 Image Style",
119
+ choices=["Comic", "Cartoon", "3D", "Anime", "Ghibli", "Victorian"],
120
  value="Comic"
121
  )
122
 
123
  with gr.Row():
124
  with gr.Column(scale=1):
125
  btn = gr.Button(
126
+ "πŸš€ Run SynthScope",
127
+ variant="primary",
128
  size="lg"
129
  )
130
  with gr.Column(scale=1):
131
  clear_btn = gr.ClearButton(
132
+ [text_input, radio_input, text_output, image_output, audio_output],
133
  value="πŸ—‘οΈ Clear All",
134
  variant="secondary",
135
  size="lg"
 
137
 
138
  # Event handlers
139
  btn.click(
140
+ fn=GoogleSearchImageGen,
141
+ inputs=[text_input, radio_input, dropdown_input],
142
  outputs=[text_output, image_output, audio_output],
143
  show_progress=True
144
  )