DigiP-AI commited on
Commit
e6e9598
·
verified ·
1 Parent(s): cca76bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -49
app.py CHANGED
@@ -3,7 +3,6 @@ import cv2
3
  import numpy as np
4
  from datetime import datetime
5
  import random
6
- from transformers import pipeline
7
 
8
  #----------Start of theme----------
9
  theme = gr.themes.Soft(
@@ -286,47 +285,37 @@ with gr.Blocks(theme=theme, css=css) as app:
286
  gr.HTML("<center><h6>🎨 Image Studio</h6></center>")
287
  with gr.Tab("Text to Image"):
288
  #gr.load("models/digiplay/AnalogMadness-realistic-model-v7")
289
- #gr.load("models/XLabs-AI/flux-RealismLora")
290
- model="./models/XLabs-AI/flux-RealismLora"
291
- def model(image):
292
- return model(image)[0]["Image"]
293
- text_prompt = gr.Textbox(label="Prompt", placeholder="Enter a prompt")
294
- image_output = gr.Image(type="pil", label="Image Output", format="png")
295
- text_btn = gr.Button("Run")
296
- text_btn.click(model, text_prompt, image_output)
297
-
298
-
299
- btn.click(summary, input_text, output_text)
300
- with gr.Tab("Flip Image"):
301
- with gr.Row():
302
- image_input = gr.Image(type="numpy", label="Upload Image")
303
- image_output = gr.Image(format="png")
304
- with gr.Row():
305
- image_button = gr.Button("Run", variant='primary')
306
- image_button.click(flip_image, inputs=image_input, outputs=image_output)
307
- with gr.Tab("Image Filters"):
308
- with gr.Row():
309
- with gr.Column():
310
- image_input = gr.Image(type="numpy", label="Upload Image")
311
- with gr.Accordion("ℹ️ Filter Categories", open=True):
312
- filter_type = gr.Dropdown(
313
- [
314
- # Basic Filters
315
- "Gray Toning", "Sepia", "X-ray", "Burn it",
316
- # Classic Filter
317
- "Charcoal Effect", "Sharpen", "Embossing", "Edge Detection",
318
- # Creative Filters
319
- "Rainbow", "Night Vision",
320
- # Special Effects
321
- "Matrix Effect", "Wave Effect", "Time Stamp", "Glitch Effect",
322
- # Artistic Filters
323
- "Pop Art", "Oil Paint", "Cartoon",
324
- # Atmospheric Filters
325
- "Autumn", "Increase Brightness"
326
- ],
327
  label="🎭 Select Filter",
328
  info="Choose the effect you want"
329
- )
330
  submit_button = gr.Button("✨ Apply Filter", variant="primary")
331
 
332
  with gr.Column():
@@ -337,17 +326,16 @@ with gr.Tab("Image Filters"):
337
  inputs=[image_input, filter_type],
338
  outputs=image_output
339
  )
340
- with gr.Tab("Image Upscaler"):
341
- with gr.Row():
342
- with gr.Column():
343
- def upscale_image(input_image, radio_input):
344
- upscale_factor = radio_input
345
- output_image = cv2.resize(input_image, None, fx = upscale_factor, fy = upscale_factor, interpolation = cv2.INTER_CUBIC)
346
- return output_image
347
 
348
  radio_input = gr.Radio(label="Upscale Levels", choices=[2, 4, 6, 8, 10], value=2)
349
 
350
  iface = gr.Interface(fn=upscale_image, inputs = [gr.Image(label="Input Image", interactive=True), radio_input], outputs = gr.Image(label="Upscaled Image", format="png"), title="Image Upscaler")
351
 
352
- app.launch(share=False)
353
-
 
3
  import numpy as np
4
  from datetime import datetime
5
  import random
 
6
 
7
  #----------Start of theme----------
8
  theme = gr.themes.Soft(
 
285
  gr.HTML("<center><h6>🎨 Image Studio</h6></center>")
286
  with gr.Tab("Text to Image"):
287
  #gr.load("models/digiplay/AnalogMadness-realistic-model-v7")
288
+ gr.load("models/XLabs-AI/flux-RealismLora")
289
+ with gr.Tab("Flip Image"):
290
+ with gr.Row():
291
+ image_input = gr.Image(type="numpy", label="Upload Image")
292
+ image_output = gr.Image(format="png")
293
+ with gr.Row():
294
+ image_button = gr.Button("Run", variant='primary')
295
+ image_button.click(flip_image, inputs=image_input, outputs=image_output)
296
+ with gr.Tab("Image Filters"):
297
+ with gr.Row():
298
+ with gr.Column():
299
+ image_input = gr.Image(type="numpy", label="Upload Image")
300
+ with gr.Accordion("ℹ️ Filter Categories", open=True):
301
+ filter_type = gr.Dropdown(
302
+ [
303
+ # Basic Filters
304
+ "Gray Toning", "Sepia", "X-ray", "Burn it",
305
+ # Classic Filter
306
+ "Charcoal Effect", "Sharpen", "Embossing", "Edge Detection",
307
+ # Creative Filters
308
+ "Rainbow", "Night Vision",
309
+ # Special Effects
310
+ "Matrix Effect", "Wave Effect", "Time Stamp", "Glitch Effect",
311
+ # Artistic Filters
312
+ "Pop Art", "Oil Paint", "Cartoon",
313
+ # Atmospheric Filters
314
+ "Autumn", "Increase Brightness"
315
+ ],
 
 
 
 
 
 
 
 
 
 
316
  label="🎭 Select Filter",
317
  info="Choose the effect you want"
318
+ )
319
  submit_button = gr.Button("✨ Apply Filter", variant="primary")
320
 
321
  with gr.Column():
 
326
  inputs=[image_input, filter_type],
327
  outputs=image_output
328
  )
329
+ with gr.Tab("Image Upscaler"):
330
+ with gr.Row():
331
+ with gr.Column():
332
+ def upscale_image(input_image, radio_input):
333
+ upscale_factor = radio_input
334
+ output_image = cv2.resize(input_image, None, fx = upscale_factor, fy = upscale_factor, interpolation = cv2.INTER_CUBIC)
335
+ return output_image
336
 
337
  radio_input = gr.Radio(label="Upscale Levels", choices=[2, 4, 6, 8, 10], value=2)
338
 
339
  iface = gr.Interface(fn=upscale_image, inputs = [gr.Image(label="Input Image", interactive=True), radio_input], outputs = gr.Image(label="Upscaled Image", format="png"), title="Image Upscaler")
340
 
341
+ app.launch(share=True)