mirror of
https://github.com/gaomingqi/Track-Anything.git
synced 2025-12-16 08:27:49 +01:00
flask is kind of web application tool, stronger than gradio, but need to write html and javascript -- li
This commit is contained in:
23
app_test.py
Normal file
23
app_test.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import gradio as gr
|
||||
|
||||
def update_iframe(slider_value):
|
||||
return f'''
|
||||
<script>
|
||||
window.addEventListener('message', function(event) {{
|
||||
if (event.data.sliderValue !== undefined) {{
|
||||
var iframe = document.getElementById("text_iframe");
|
||||
iframe.src = "http://localhost:5001/get_text?slider_value=" + event.data.sliderValue;
|
||||
}}
|
||||
}}, false);
|
||||
</script>
|
||||
<iframe id="text_iframe" src="http://localhost:5001/get_text?slider_value={slider_value}" style="width: 100%; height: 100%; border: none;"></iframe>
|
||||
'''
|
||||
|
||||
iface = gr.Interface(
|
||||
fn=update_iframe,
|
||||
inputs=gr.inputs.Slider(minimum=0, maximum=100, step=1, default=50),
|
||||
outputs=gr.outputs.HTML(),
|
||||
allow_flagging=False,
|
||||
)
|
||||
|
||||
iface.launch(server_name='0.0.0.0', server_port=12212)
|
||||
Reference in New Issue
Block a user