Spaces:
Runtime error
Runtime error
changes app.py
Browse files- __pycache__/app.cpython-38.pyc +0 -0
- app.py +6 -28
__pycache__/app.cpython-38.pyc
CHANGED
Binary files a/__pycache__/app.cpython-38.pyc and b/__pycache__/app.cpython-38.pyc differ
|
|
app.py
CHANGED
@@ -1,33 +1,15 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
-
import torch
|
4 |
|
5 |
-
def update_value(val):
|
6 |
-
return f'Value is set to {val}'
|
7 |
|
8 |
-
def
|
9 |
-
image
|
10 |
-
conf_threshold: gr.Slider = 0.20,
|
11 |
-
):
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
model = torch.hub.load("WongKinYiu/yolov7","custom",f"{path}")
|
16 |
-
model.conf = conf_threshold
|
17 |
-
results = model([image], size=640)
|
18 |
-
return results.render()[0]
|
19 |
-
|
20 |
-
demo = gr.Blocks()
|
21 |
-
|
22 |
-
with demo:
|
23 |
-
|
24 |
-
gr.Interface(
|
25 |
-
yolov7_inference,
|
26 |
gr.Image(type="pil"),
|
27 |
"image",
|
28 |
-
|
29 |
-
description = "contact: [email protected]",
|
30 |
-
|
31 |
examples=[
|
32 |
os.path.join(os.path.dirname(__file__), "example1.JPG"),
|
33 |
os.path.join(os.path.dirname(__file__), "example2.JPG"),
|
@@ -35,8 +17,4 @@ with demo:
|
|
35 |
],
|
36 |
)
|
37 |
|
38 |
-
|
39 |
-
conf_threshold = gr.Slider(minimum=0, maximum=1, step=0.1, label='Value')
|
40 |
-
conf_threshold.change(fn=update_value, inputs=conf_threshold, outputs=md)
|
41 |
-
|
42 |
-
demo.launch(debug=False)
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
|
|
3 |
|
|
|
|
|
4 |
|
5 |
+
def image_mod(image):
|
6 |
+
return image.rotate(45)
|
|
|
|
|
7 |
|
8 |
+
demo = gr.Interface(
|
9 |
+
image_mod,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
gr.Image(type="pil"),
|
11 |
"image",
|
12 |
+
flagging_options=["blurry", "incorrect", "other"],
|
|
|
|
|
13 |
examples=[
|
14 |
os.path.join(os.path.dirname(__file__), "example1.JPG"),
|
15 |
os.path.join(os.path.dirname(__file__), "example2.JPG"),
|
|
|
17 |
],
|
18 |
)
|
19 |
|
20 |
+
demo.launch()
|
|
|
|
|
|
|
|