Spaces:
Runtime error
Runtime error
xribene
commited on
Commit
·
c806a32
1
Parent(s):
df4b493
old app
Browse files
app.py
CHANGED
@@ -1,66 +1,14 @@
|
|
1 |
-
# import gradio as gr
|
2 |
-
|
3 |
-
|
4 |
-
# def process(name):
|
5 |
-
# return "Hello re malakako" + name + "!"
|
6 |
-
|
7 |
-
|
8 |
-
# with gr.Blocks() as demo:
|
9 |
-
# name = gr.Textbox(label="Score (vextab or musicxml)")
|
10 |
-
# output = gr.Textbox(label="Difficulty Analysis Report")
|
11 |
-
# greet_btn = gr.Button("Process")
|
12 |
-
# greet_btn.click(fn=process, inputs=name, outputs=output, api_name="process")
|
13 |
-
|
14 |
-
# demo.launch()
|
15 |
-
|
16 |
-
|
17 |
-
import time
|
18 |
import gradio as gr
|
19 |
|
20 |
|
21 |
-
def
|
22 |
-
for
|
23 |
-
print(f"Current step: {i}")
|
24 |
-
time.sleep(1)
|
25 |
-
yield str(i)
|
26 |
-
|
27 |
-
|
28 |
-
def long_prediction(*args, **kwargs):
|
29 |
-
time.sleep(10)
|
30 |
-
return 42
|
31 |
|
32 |
|
33 |
with gr.Blocks() as demo:
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
output = gr.Textbox(label="Iterative Output")
|
39 |
-
stop = gr.Button(value="Stop Iterating")
|
40 |
-
with gr.Column():
|
41 |
-
textbox = gr.Textbox(label="Prompt")
|
42 |
-
prediction = gr.Number(label="Expensive Calculation")
|
43 |
-
run_pred = gr.Button(value="Run Expensive Calculation")
|
44 |
-
with gr.Column():
|
45 |
-
cancel_on_change = gr.Textbox(label="Cancel Iteration and Expensive Calculation on Change")
|
46 |
-
cancel_on_submit = gr.Textbox(label="Cancel Iteration and Expensive Calculation on Submit")
|
47 |
-
echo = gr.Textbox(label="Echo")
|
48 |
-
with gr.Row():
|
49 |
-
with gr.Column():
|
50 |
-
image = gr.Image(sources=["webcam"], label="Cancel on clear", interactive=True)
|
51 |
-
with gr.Column():
|
52 |
-
video = gr.Video(sources=["webcam"], label="Cancel on start recording", interactive=True)
|
53 |
-
|
54 |
-
click_event = run.click(fake_diffusion, n, output)
|
55 |
-
stop.click(fn=None, inputs=None, outputs=None, cancels=[click_event])
|
56 |
-
pred_event = run_pred.click(fn=long_prediction, inputs=[textbox], outputs=prediction)
|
57 |
-
|
58 |
-
cancel_on_change.change(None, None, None, cancels=[click_event, pred_event])
|
59 |
-
cancel_on_submit.submit(lambda s: s, cancel_on_submit, echo, cancels=[click_event, pred_event])
|
60 |
-
image.clear(None, None, None, cancels=[click_event, pred_event])
|
61 |
-
video.start_recording(None, None, None, cancels=[click_event, pred_event])
|
62 |
-
|
63 |
-
demo.queue(max_size=20)
|
64 |
|
65 |
-
|
66 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
|
4 |
+
def process(name):
|
5 |
+
return "Difficulty Report for " + name + "!"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
|
8 |
with gr.Blocks() as demo:
|
9 |
+
name = gr.Textbox(label="Score (vextab or musicxml)")
|
10 |
+
output = gr.Textbox(label="Difficulty Analysis Report")
|
11 |
+
greet_btn = gr.Button("Process")
|
12 |
+
greet_btn.click(fn=process, inputs=name, outputs=output, api_name="process")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
+
demo.launch()
|
|