uumerrr684 commited on
Commit
cab2c2f
·
verified ·
1 Parent(s): 102b1cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -13
app.py CHANGED
@@ -24,12 +24,23 @@ def summarize(text):
24
  except Exception as e:
25
  return f"🚨 Error: {str(e)}", ""
26
 
27
- # ======= ENHANCED UI ======= #
28
  custom_css = """
29
- #input-box, #output-box {
 
 
 
 
 
 
 
 
 
 
30
  font-family: 'Helvetica', sans-serif;
31
  border-radius: 12px !important;
32
  padding: 15px !important;
 
33
  }
34
  #submit-btn {
35
  background: linear-gradient(45deg, #FF6B6B, #4ECDC4) !important;
@@ -38,44 +49,58 @@ custom_css = """
38
  font-weight: bold !important;
39
  border-radius: 8px !important;
40
  padding: 12px 24px !important;
 
41
  }
42
  #submit-btn:hover {
43
- transform: scale(1.02);
44
- box-shadow: 0 4px 8px rgba(0,0,0,0.1);
45
  }
46
  .header {
47
  text-align: center;
48
  font-weight: 800 !important;
 
49
  background: linear-gradient(45deg, #4F6BFF, #8E54E9);
50
  -webkit-background-clip: text;
51
  -webkit-text-fill-color: transparent;
 
 
 
 
 
 
52
  }
53
  .status {
54
  font-size: 0.9em;
55
  padding: 8px;
56
  border-radius: 6px;
57
  text-align: center;
 
 
 
 
 
58
  }
59
  """
60
 
61
  with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as app:
62
  gr.Markdown("""
63
  <div class='header'>✨ SUMMIFY PRO ✨</div>
64
- <div style='text-align:center'>Transform long texts into concise summaries</div>
65
  """)
66
 
67
  with gr.Row():
68
  input_txt = gr.Textbox(
69
  label="Your Text",
70
- placeholder="Paste any article, essay, or document...",
71
  lines=7,
72
- elem_id="input-box"
 
73
  )
74
  output_txt = gr.Textbox(
75
  label="Summary",
76
- interactive=False,
77
  lines=7,
78
- elem_id="output-box"
 
79
  )
80
 
81
  status = gr.Textbox(
@@ -85,14 +110,23 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as app:
85
  )
86
 
87
  with gr.Row():
88
- gr.Button(
89
  "Summarize",
90
  variant="primary",
91
  elem_id="submit-btn"
92
  )
93
- gr.ClearButton([input_txt, output_txt, status])
 
 
 
 
 
 
 
 
 
94
 
95
- # Dark mode toggle
96
  gr.HTML("""
97
  <script>
98
  function toggleDark() {
@@ -107,12 +141,14 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as app:
107
  position: fixed;
108
  bottom: 20px;
109
  right: 20px;
110
- padding: 8px 12px;
111
  border-radius: 50%;
112
  background: #4F6BFF;
113
  color: white;
114
  border: none;
115
  cursor: pointer;
 
 
116
  ">🌓</button>
117
  """)
118
 
 
24
  except Exception as e:
25
  return f"🚨 Error: {str(e)}", ""
26
 
27
+ # ======= FIXED & ENHANCED UI ======= #
28
  custom_css = """
29
+ .gradio-container {
30
+ max-width: 800px !important;
31
+ margin: auto !important;
32
+ }
33
+ #input-box {
34
+ font-family: 'Helvetica', sans-serif;
35
+ border-radius: 12px !important;
36
+ padding: 15px !important;
37
+ background: white !important;
38
+ }
39
+ #output-box {
40
  font-family: 'Helvetica', sans-serif;
41
  border-radius: 12px !important;
42
  padding: 15px !important;
43
+ background: #f8f9fa !important;
44
  }
45
  #submit-btn {
46
  background: linear-gradient(45deg, #FF6B6B, #4ECDC4) !important;
 
49
  font-weight: bold !important;
50
  border-radius: 8px !important;
51
  padding: 12px 24px !important;
52
+ transition: all 0.3s !important;
53
  }
54
  #submit-btn:hover {
55
+ transform: scale(1.02) !important;
56
+ box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
57
  }
58
  .header {
59
  text-align: center;
60
  font-weight: 800 !important;
61
+ font-size: 2em !important;
62
  background: linear-gradient(45deg, #4F6BFF, #8E54E9);
63
  -webkit-background-clip: text;
64
  -webkit-text-fill-color: transparent;
65
+ margin-bottom: 10px !important;
66
+ }
67
+ .subheader {
68
+ text-align: center;
69
+ color: #666 !important;
70
+ margin-bottom: 20px !important;
71
  }
72
  .status {
73
  font-size: 0.9em;
74
  padding: 8px;
75
  border-radius: 6px;
76
  text-align: center;
77
+ background: #f0f0f0;
78
+ }
79
+ .dark .status {
80
+ background: #333 !important;
81
+ color: white !important;
82
  }
83
  """
84
 
85
  with gr.Blocks(css=custom_css, theme=gr.themes.Soft()) as app:
86
  gr.Markdown("""
87
  <div class='header'>✨ SUMMIFY PRO ✨</div>
88
+ <div class='subheader'>Transform long texts into concise summaries</div>
89
  """)
90
 
91
  with gr.Row():
92
  input_txt = gr.Textbox(
93
  label="Your Text",
94
+ placeholder="Paste any article, essay, or document here...",
95
  lines=7,
96
+ elem_id="input-box",
97
+ interactive=True # THIS WAS THE FIX - REMOVED THE DISABLED STATE
98
  )
99
  output_txt = gr.Textbox(
100
  label="Summary",
 
101
  lines=7,
102
+ elem_id="output-box",
103
+ interactive=False # Output should remain non-editable
104
  )
105
 
106
  status = gr.Textbox(
 
110
  )
111
 
112
  with gr.Row():
113
+ submit_btn = gr.Button(
114
  "Summarize",
115
  variant="primary",
116
  elem_id="submit-btn"
117
  )
118
+ clear_btn = gr.ClearButton(
119
+ components=[input_txt, output_txt, status],
120
+ value="🗑️ Clear All"
121
+ )
122
+
123
+ submit_btn.click(
124
+ fn=summarize,
125
+ inputs=input_txt,
126
+ outputs=[output_txt, status]
127
+ )
128
 
129
+ # Enhanced dark mode toggle
130
  gr.HTML("""
131
  <script>
132
  function toggleDark() {
 
141
  position: fixed;
142
  bottom: 20px;
143
  right: 20px;
144
+ padding: 10px;
145
  border-radius: 50%;
146
  background: #4F6BFF;
147
  color: white;
148
  border: none;
149
  cursor: pointer;
150
+ box-shadow: 0 2px 10px rgba(0,0,0,0.2);
151
+ z-index: 999;
152
  ">🌓</button>
153
  """)
154