Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -81,7 +81,13 @@ def create_gradio_app(api_spec, api_url):
|
|
81 |
inputs.append(data_field)
|
82 |
print(output_schema)
|
83 |
if output_schema["type"] == "string":
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
outputs.append(output_component)
|
86 |
elif output_schema["type"] == "array":
|
87 |
if "format" in output_schema["items"]:
|
@@ -101,7 +107,7 @@ def create_gradio_app(api_spec, api_url):
|
|
101 |
payload = {"input": {}}
|
102 |
for i, key in enumerate(keys):
|
103 |
value = args[i]
|
104 |
-
if(os.path.exists(value)):
|
105 |
value = "http://localhost:7860/file=" + value
|
106 |
payload["input"][key] = value
|
107 |
print(payload)
|
|
|
81 |
inputs.append(data_field)
|
82 |
print(output_schema)
|
83 |
if output_schema["type"] == "string":
|
84 |
+
if "format" in output_schema:
|
85 |
+
if(output_schema["format"] == "uri"):
|
86 |
+
output_component = gr.Gallery(label=output_schema["title"])
|
87 |
+
else:
|
88 |
+
output_component = gr.Textbox(label="Output")
|
89 |
+
else:
|
90 |
+
output_component = gr.Textbox(label="Output")
|
91 |
outputs.append(output_component)
|
92 |
elif output_schema["type"] == "array":
|
93 |
if "format" in output_schema["items"]:
|
|
|
107 |
payload = {"input": {}}
|
108 |
for i, key in enumerate(keys):
|
109 |
value = args[i]
|
110 |
+
if value and (os.path.exists(str(value))):
|
111 |
value = "http://localhost:7860/file=" + value
|
112 |
payload["input"][key] = value
|
113 |
print(payload)
|