wushuang98 commited on
Commit
dbecd1e
·
verified ·
1 Parent(s): 396a29b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -12
app.py CHANGED
@@ -1,17 +1,18 @@
1
  import gradio as gr
2
 
3
- def dummy_function(input_text):
4
- return f"You entered: {input_text}"
5
 
6
- iface = gr.Interface(
7
- fn=dummy_function,
8
- inputs="text",
9
- outputs="text",
10
- )
11
 
12
- iframe_html = """
13
- <iframe src="http://animeit.cn/" width="600" height="400" frameborder="0"></iframe>
14
- """
15
- iface.add_component(gr.HTML(iframe_html))
 
16
 
17
- iface.launch()
 
1
  import gradio as gr
2
 
3
+ def update_iframe(url):
4
+ return f'<iframe src="{url}" width="100%" height="500"></iframe>'
5
 
6
+ with gr.Blocks() as demo:
7
+ with gr.Row():
8
+ url_input = gr.Textbox(label="输入URL", value="http://animeit.cn/")
9
+ submit_btn = gr.Button("加载")
10
+ iframe = gr.HTML()
11
 
12
+ submit_btn.click(
13
+ fn=update_iframe,
14
+ inputs=url_input,
15
+ outputs=iframe
16
+ )
17
 
18
+ demo.launch()