Skip to content

Commit

Permalink
can turn off flagging from interface
Browse files Browse the repository at this point in the history
  • Loading branch information
aliabd committed Jul 27, 2020
1 parent 2eebcf6 commit a7f16bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion gradio/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, fn, inputs, outputs, saliency=None, verbose=False, examples=N
live=False, show_input=True, show_output=True,
capture_session=False, title=None, description=None,
thumbnail=None, server_port=None, server_name=networking.LOCALHOST_NAME,
allow_screenshot=True):
allow_screenshot=True, allow_flagging=True):
"""
Parameters:
fn (Callable): the function to wrap an interface around.
Expand Down Expand Up @@ -101,6 +101,7 @@ def get_output_instance(iface):
self.server_port = server_port
self.simple_server = None
self.allow_screenshot = allow_screenshot
self.allow_flagging = allow_flagging
Interface.instances.add(self)

data = {'fn': fn,
Expand Down
4 changes: 3 additions & 1 deletion gradio/static/css/gradio.css
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ input.submit {
input.submit:hover {
background-color: #f39c12;
}

.flag {
visibility: hidden;
}
.flag.flagged {
background-color: pink;
}
Expand Down
3 changes: 3 additions & 0 deletions gradio/static/js/gradio.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ function gradio(config, fn, target) {
if (config["allow_screenshot"]) {
target.find(".screenshot").css("visibility", "visible");
}
if(config["allow_flagging"]){
target.find(".flag").css("visibility", "visible");
}
target.find(".screenshot").click(function() {
$(".screenshot").hide();
$(".screenshot_logo").show();
Expand Down

0 comments on commit a7f16bd

Please sign in to comment.