import gradio
demo = gradio.Interface(fn=function, inputs=[a, b, **], outputs=[c, d, **])
# def function(a, b, **):
# pass
# return c, d, **
# demo.launch()
demo.launch(server_name="0.0.0.0", server_port=8899, share=True,
auth=("username", "password"))
import gradio as gr
def greet(name):
return "Hello " + name + "!"
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch()
import gradio as gr
def greet(name):
return "Hello " + name + "!"
demo = gr.Interface(
fn=greet,
inputs=gr.Textbox(lines=2, placeholder="Name Here..."),
outputs="text",
)
demo.launch()
def file_test_fn_file(file_tmp):
file_path = file_tmp.name
print(file_path)
with open(file_path, 'r') as file:
file_content = file.read()
return file_content
msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
bot, chatbot, chatbot
)
Run this event 'every' number of seconds while the client connection is open. Interpreted in seconds. Queue must be enabled.
period.change(get_plot, period, plot, every=1, cancels=[dep])
需要EventData支持
def on_select_load_history(evt: gr.SelectData, files):
print("=" * 20 + "run_text" + "=" * 20)
# print("inputs:", text, state)
text = file_test_fn_file(files[evt.index])