HAL1993 commited on
Commit
3b325c8
·
verified ·
1 Parent(s): dfd0276

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -8
app.py CHANGED
@@ -25,7 +25,6 @@ logger = logging.getLogger(__name__)
25
 
26
  @spaces.GPU
27
  def translate_albanian_to_english(text: str, language: str = "en"):
28
- """Translate Albanian text to English using an external HF Space."""
29
  if not text.strip():
30
  raise gr.Error("Please enter a description.")
31
  for attempt in range(2):
@@ -93,7 +92,6 @@ QUALITY_PROMPT = ", high quality, detailed, vibrant, professional lighting"
93
 
94
  @spaces.GPU(duration=40)
95
  def infer(image, prompt):
96
- """Generate an edited image from the input image and prompt."""
97
  negative_prompt = ""
98
  seed = random.randint(0, MAX_SEED)
99
  generator = torch.Generator(device=device).manual_seed(seed)
@@ -164,7 +162,14 @@ def create_demo():
164
  background:#000000 !important;
165
  color:#FFFFFF !important;
166
  }
167
- .gr-row{
 
 
 
 
 
 
 
168
  width:100% !important;
169
  max-width:100vw !important;
170
  margin:0 !important;
@@ -336,9 +341,24 @@ def create_demo():
336
  animation:slide 4s ease-in-out infinite,glow-hover 3s ease-in-out infinite;
337
  transform:scale(1.05);
338
  }
339
- button[aria-label="Fullscreen"],button[aria-label="Share"],button[aria-label="Download"]{
340
  display:none !important;
341
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
342
  .progress-text,.gr-progress,.gr-prose,.gr-log{
343
  display:none !important;
344
  }
@@ -415,17 +435,17 @@ def create_demo():
415
  show_download_button=False,
416
  show_share_button=False,
417
  interactive=True,
418
- elem_classes=["gradio-component", "image-container"],
419
  )
420
  prompt = gr.Textbox(
421
  label="Prompt",
422
  lines=3,
423
- elem_classes=["gradio-component"],
424
  )
425
  run_button = gr.Button(
426
  "Edit!",
427
  variant="primary",
428
- elem_classes=["gradio-component", "gr-button-primary"],
429
  )
430
  result_image = gr.Image(
431
  label="Result Image",
@@ -433,7 +453,7 @@ def create_demo():
433
  interactive=False,
434
  show_download_button=True,
435
  show_share_button=False,
436
- elem_classes=["gradio-component", "image-container"],
437
  )
438
  run_button.click(fn=infer, inputs=[input_image, prompt], outputs=[result_image])
439
  prompt.submit(fn=infer, inputs=[input_image, prompt], outputs=[result_image])
 
25
 
26
  @spaces.GPU
27
  def translate_albanian_to_english(text: str, language: str = "en"):
 
28
  if not text.strip():
29
  raise gr.Error("Please enter a description.")
30
  for attempt in range(2):
 
92
 
93
  @spaces.GPU(duration=40)
94
  def infer(image, prompt):
 
95
  negative_prompt = ""
96
  seed = random.randint(0, MAX_SEED)
97
  generator = torch.Generator(device=device).manual_seed(seed)
 
162
  background:#000000 !important;
163
  color:#FFFFFF !important;
164
  }
165
+ .gr-row,.gr-column{
166
+ width:100% !important;
167
+ max-width:100vw !important;
168
+ margin:0 !important;
169
+ padding:0 !important;
170
+ box-sizing:border-box !important;
171
+ }
172
+ .gradio-container,.gradio-app,.gradio-interface{
173
  width:100% !important;
174
  max-width:100vw !important;
175
  margin:0 !important;
 
341
  animation:slide 4s ease-in-out infinite,glow-hover 3s ease-in-out infinite;
342
  transform:scale(1.05);
343
  }
344
+ button[aria-label="Fullscreen"],button[aria-label="Share"]{
345
  display:none !important;
346
  }
347
+ button[aria-label="Download"]{
348
+ transform:scale(3);
349
+ transform-origin:top right;
350
+ background:#000000 !important;
351
+ color:#FFFFFF !important;
352
+ border:1px solid #FFFFFF !important;
353
+ border-radius:4px;
354
+ padding:0.4rem !important;
355
+ margin:0.5rem !important;
356
+ box-shadow:0 0 8px rgba(255,255,255,0.3) !important;
357
+ transition:box-shadow 0.3s;
358
+ }
359
+ button[aria-label="Download"]:hover{
360
+ box-shadow:0 0 12px rgba(255,255,255,0.5) !important;
361
+ }
362
  .progress-text,.gr-progress,.gr-prose,.gr-log{
363
  display:none !important;
364
  }
 
435
  show_download_button=False,
436
  show_share_button=False,
437
  interactive=True,
438
+ elem_classes=["gradio-component", "image-container"]
439
  )
440
  prompt = gr.Textbox(
441
  label="Prompt",
442
  lines=3,
443
+ elem_classes=["gradio-component"]
444
  )
445
  run_button = gr.Button(
446
  "Edit!",
447
  variant="primary",
448
+ elem_classes=["gradio-component", "gr-button-primary"]
449
  )
450
  result_image = gr.Image(
451
  label="Result Image",
 
453
  interactive=False,
454
  show_download_button=True,
455
  show_share_button=False,
456
+ elem_classes=["gradio-component", "image-container"]
457
  )
458
  run_button.click(fn=infer, inputs=[input_image, prompt], outputs=[result_image])
459
  prompt.submit(fn=infer, inputs=[input_image, prompt], outputs=[result_image])