Spaces:
Runtime error
Runtime error
allow for download of files
Browse files
app.py
CHANGED
@@ -140,7 +140,6 @@ def review_3d_model(uuid:str) -> None:
|
|
140 |
uuid = uuid.replace("-","")
|
141 |
bucket_name = os.getenv('GOOGLE_BUCKET_NAME')
|
142 |
|
143 |
-
|
144 |
credentials_str = SERVICE_ACOUNT_STUFF = os.getenv('GOOGLE_APPLICATION_CREDENTIALS_JSON')
|
145 |
|
146 |
# Create an instance of CloudStorageManager
|
@@ -179,7 +178,20 @@ def review_3d_model(uuid:str) -> None:
|
|
179 |
remove_files([xx,xx_as_stl])
|
180 |
return response
|
181 |
|
|
|
|
|
|
|
182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
|
184 |
generate_apparatus_interface = gr.Interface(
|
185 |
fn=generate_apparatus,
|
@@ -221,18 +233,29 @@ review_3d_model_interface = gr.Interface(
|
|
221 |
description="Input the UUID of a 3D model to review its images and provide feedback.",
|
222 |
)
|
223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
demo = gr.TabbedInterface([
|
225 |
generate_apparatus_interface,
|
226 |
generate_experiment_interface,
|
227 |
search_experiments_interface,
|
228 |
search_apparatus_interface,
|
229 |
review_3d_model_interface,
|
|
|
230 |
], [
|
231 |
"Generate Apparatus",
|
232 |
"Generate Experiment",
|
233 |
"Search Existing Experiments",
|
234 |
"Search Existing Apparatuses",
|
235 |
-
"review_3d_model_interface"
|
|
|
236 |
])
|
237 |
|
238 |
if __name__ == "__main__":
|
|
|
140 |
uuid = uuid.replace("-","")
|
141 |
bucket_name = os.getenv('GOOGLE_BUCKET_NAME')
|
142 |
|
|
|
143 |
credentials_str = SERVICE_ACOUNT_STUFF = os.getenv('GOOGLE_APPLICATION_CREDENTIALS_JSON')
|
144 |
|
145 |
# Create an instance of CloudStorageManager
|
|
|
178 |
remove_files([xx,xx_as_stl])
|
179 |
return response
|
180 |
|
181 |
+
def download_3d_model(uuid:str):
|
182 |
+
uuid = uuid.replace("-","")
|
183 |
+
bucket_name = os.getenv('GOOGLE_BUCKET_NAME')
|
184 |
|
185 |
+
credentials_str = SERVICE_ACOUNT_STUFF = os.getenv('GOOGLE_APPLICATION_CREDENTIALS_JSON')
|
186 |
+
|
187 |
+
# Create an instance of CloudStorageManager
|
188 |
+
manager = CloudStorageManager(bucket_name, credentials_str)
|
189 |
+
xx = manager.get_file_by_uuid(uuid)
|
190 |
+
manager.download_file(
|
191 |
+
xx,
|
192 |
+
xx
|
193 |
+
)
|
194 |
+
return xx
|
195 |
|
196 |
generate_apparatus_interface = gr.Interface(
|
197 |
fn=generate_apparatus,
|
|
|
233 |
description="Input the UUID of a 3D model to review its images and provide feedback.",
|
234 |
)
|
235 |
|
236 |
+
download_3d_model_interface = gr.Interface(
|
237 |
+
fn=download_3d_model,
|
238 |
+
inputs=["text"],
|
239 |
+
outputs=gr.File(label="Input File"),
|
240 |
+
title="Review 3D Model",
|
241 |
+
description="Input the UUID of a 3D model to review its images and provide feedback.",
|
242 |
+
)
|
243 |
+
|
244 |
+
|
245 |
demo = gr.TabbedInterface([
|
246 |
generate_apparatus_interface,
|
247 |
generate_experiment_interface,
|
248 |
search_experiments_interface,
|
249 |
search_apparatus_interface,
|
250 |
review_3d_model_interface,
|
251 |
+
download_3d_model_interface,
|
252 |
], [
|
253 |
"Generate Apparatus",
|
254 |
"Generate Experiment",
|
255 |
"Search Existing Experiments",
|
256 |
"Search Existing Apparatuses",
|
257 |
+
"review_3d_model_interface",
|
258 |
+
"download_3d_model_interface"
|
259 |
])
|
260 |
|
261 |
if __name__ == "__main__":
|