Spaces:
Runtime error
Runtime error
File size: 1,398 Bytes
05b83fe 49c3111 8b32732 01cb398 8b32732 49c3111 7532393 a8ac375 01cb398 db95782 01cb398 21f6667 01cb398 a8ac375 01cb398 a8ac375 01cb398 a8ac375 05b83fe 29ff46f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
'''
import gradio as gr
def ask(txt):
print("Asked!")
return "Fun", "Times"
desc = "Description"
article_text = "Article Text!"
with gr.Blocks(title=desc,
description=desc,
article=article_text,
allow_flagging="manual",
flagging_options=["Innacurate", "Off Topic"],
flagging_dir="flags",
flagging_callback=gr.SimpleCSVLogger(),
analytics_enabled=True
) as demo:
gr.Markdown(
"""
# Maryland Kids Law!
Start typing below to see the output.
""")
txt = gr.Textbox(label="Ask your question:", lines=5, placeholder="Is it ok to punch a kid?")
txt_2 = gr.Textbox(value="Your Question will appear here.", label="Output", lines=5)
txt_3 = gr.Textbox(value="The references cited to answer your question will appear here.", label="References", lines=5)
btn = gr.Button(value="Ask!")
btn.click(ask, inputs=txt, outputs=[txt_2, txt_3])
gr.examples=[
["What a beautiful morning for a walk!"],
["It was the best of times, it was the worst of times."]
]
gr.HTML("hello world!")
demo.launch()
'''
import gradio as gr
def image_classifier(inp):
return {'cat': 0.3, 'dog': 0.7}
demo = gr.Interface(fn=image_classifier, inputs="image", outputs="label",
flagging_callback=gr.SimpleCSVLogger()) |