Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,7 +32,7 @@ def Create_Organization(org_name, org_handle):
|
|
| 32 |
|
| 33 |
return "Organization Created: " + o
|
| 34 |
|
| 35 |
-
def
|
| 36 |
s3_client = boto3.client('s3')
|
| 37 |
bucket_name = 'myorg'
|
| 38 |
|
|
@@ -40,18 +40,23 @@ def list_s3_folders():
|
|
| 40 |
|
| 41 |
folders = [o.get('Prefix') for o in result.get('CommonPrefixes')]
|
| 42 |
return "\n".join(folders)
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
return "Organization Created: " + o
|
| 34 |
|
| 35 |
+
def list_of_organization():
|
| 36 |
s3_client = boto3.client('s3')
|
| 37 |
bucket_name = 'myorg'
|
| 38 |
|
|
|
|
| 40 |
|
| 41 |
folders = [o.get('Prefix') for o in result.get('CommonPrefixes')]
|
| 42 |
return "\n".join(folders)
|
| 43 |
+
def main_function(action, org_name=None, org_handle=None):
|
| 44 |
+
if action == "Create Organization":
|
| 45 |
+
return Create_Organization(org_name, org_handle)
|
| 46 |
+
elif action == "list_of_organization":
|
| 47 |
+
return list_s3_folders()
|
| 48 |
+
|
| 49 |
+
interface = gr.Interface(
|
| 50 |
+
fn=main_function,
|
| 51 |
+
inputs=[
|
| 52 |
+
gr.inputs.Dropdown(
|
| 53 |
+
choices=["Create Organization", "list_of_organization"],
|
| 54 |
+
label="Select an Action"
|
| 55 |
+
),
|
| 56 |
+
gr.inputs.Textbox(label="Organization Name"),
|
| 57 |
+
gr.inputs.Textbox(label="Organization Handle"),
|
| 58 |
+
],
|
| 59 |
+
outputs=gr.outputs.Textbox(label="Message"),
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
interface.launch()
|