This commit is contained in:
dawoodkhan82 2022-02-15 17:50:05 -05:00
commit ef9b5e228a
4 changed files with 49 additions and 8 deletions

View File

@ -684,7 +684,7 @@ class Interface:
if self.enable_queue is None:
self.enable_queue = enable_queue
if self.allow_flagging:
if self.allow_flagging != "never":
self.flagging_callback.setup(self.flagging_dir)
config = self.get_config_file()

View File

@ -67,5 +67,28 @@ class TestHuggingFaceDatasetSaver(unittest.TestCase):
self.assertEqual(row_count, 2) # 3 rows written including header
class TestDisableFlagging(unittest.TestCase):
def test_flagging_no_permission_error_with_flagging_disabled(self):
with tempfile.TemporaryDirectory() as tmpdirname:
os.chmod(tmpdirname, 0o444) # Make directory read-only
nonwritable_path = os.path.join(
tmpdirname, 'flagging_dir')
io = gr.Interface(
lambda x: x,
"text",
"text",
allow_flagging="never",
flagging_dir=nonwritable_path
)
try:
io.launch(prevent_thread_lock=True)
except PermissionError:
self.fail("launch() raised a PermissionError unexpectedly")
io.close()
if __name__ == "__main__":
unittest.main()

View File

@ -0,0 +1,18 @@
{
"interface": {
"submit": "Absenden",
"clear": "Löschen",
"interpret": "Ersteller",
"flag": "Flag",
"examples": "Beispiele",
"drop_image": "Bild hier ablegen",
"drop_video": "Video hier ablegen",
"drop_audio": "Audio hier ablegen",
"drop_file": "Datei hier ablegen",
"drop_csv": "CSV Datei hier ablegen",
"or": "oder",
"click_to_upload": "Hochladen",
"view_api": "API anschauen",
"built_with_Gradio": "Mit Gradio erstellt"
}
}

View File

@ -5,14 +5,14 @@
"interpret": "Interpretar",
"flag": "Avisar",
"examples": "Ejemplos",
"drop_image": "Coloque la Imagen Aquí",
"drop_video": "Coloque la Video Aquí",
"drop_audio": "Coloque la Audio Aquí",
"drop_file": "Coloque la Archivo Aquí",
"drop_csv": "Coloque el CSV Aquí",
"drop_image": "Coloque la imagen aquí",
"drop_video": "Coloque el video aquí",
"drop_audio": "Coloque el audio aquí",
"drop_file": "Coloque el archivo aquí",
"drop_csv": "Coloque el CSV aquí",
"or": "o",
"click_to_upload": "Haga Clic para Cargar",
"view_api": "Para ver la API",
"click_to_upload": "Haga click para cargar",
"view_api": "Ver la API",
"built_with_Gradio": "Construido con Gradio"
}
}