Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,10 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
from torchvision import models, transforms
|
4 |
-
from PIL import Image, ImageEnhance
|
5 |
import numpy as np
|
6 |
-
import cv2
|
7 |
|
8 |
-
model = models.detection.fasterrcnn_resnet50_fpn(
|
9 |
model.eval()
|
10 |
|
11 |
transform = transforms.Compose([
|
@@ -54,15 +53,15 @@ def process_image(image, edit_type, factor):
|
|
54 |
iface = gr.Interface(
|
55 |
fn=process_image,
|
56 |
inputs=[
|
57 |
-
gr.
|
58 |
-
gr.
|
59 |
-
gr.
|
60 |
],
|
61 |
outputs=[
|
62 |
-
gr.
|
63 |
-
gr.
|
64 |
],
|
65 |
live=True
|
66 |
)
|
67 |
|
68 |
-
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
from torchvision import models, transforms
|
4 |
+
from PIL import Image, ImageEnhance, ImageDraw
|
5 |
import numpy as np
|
|
|
6 |
|
7 |
+
model = models.detection.fasterrcnn_resnet50_fpn(weights=models.detection.FasterRCNN_ResNet50_FPN_Weights.COCO_V1)
|
8 |
model.eval()
|
9 |
|
10 |
transform = transforms.Compose([
|
|
|
53 |
iface = gr.Interface(
|
54 |
fn=process_image,
|
55 |
inputs=[
|
56 |
+
gr.Image(type="pil"),
|
57 |
+
gr.Radio(choices=["None", "Crop", "Adjust Color"]),
|
58 |
+
gr.Slider(0.5, 2.0, step=0.1, label="Factor")
|
59 |
],
|
60 |
outputs=[
|
61 |
+
gr.Image(type="pil"),
|
62 |
+
gr.Textbox(label="Result")
|
63 |
],
|
64 |
live=True
|
65 |
)
|
66 |
|
67 |
+
iface.launch()
|