Spaces:
Sleeping
Sleeping
john
commited on
Commit
•
35bd487
1
Parent(s):
f6682fe
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,26 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import cv2
|
3 |
|
4 |
+
def draw(im):
|
5 |
+
cv2.rectangle(im,(50,50), (200,200), (0, 255, 255), 2)
|
6 |
+
return im
|
7 |
+
|
8 |
+
def welcome(name):
|
9 |
+
return f"Hello {name}!"
|
10 |
+
|
11 |
+
def background_task():
|
12 |
+
while True:
|
13 |
+
print("Background task running...")
|
14 |
+
time.sleep(1)
|
15 |
+
|
16 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
17 |
+
inp = gr.Image(source="webcam", shape=(10,10), streaming=True, hide=True)
|
18 |
+
out = gr.Image(label='output', )
|
19 |
+
inp.change(draw, inp, out)
|
20 |
+
|
21 |
+
name_input = gr.Textbox(label='Enter your name')
|
22 |
+
out_text = gr.Textbox()
|
23 |
+
name_input.change(welcome, name_input, out_text)
|
24 |
+
|
25 |
+
|
26 |
+
demo.launch()
|