Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,27 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
def process_images(files):
|
| 4 |
+
# Instantiate your AI model
|
| 5 |
+
ai_model = gr.Interface.load("models/facebook/dino-vitb16")
|
| 6 |
+
|
| 7 |
+
processed_files = []
|
| 8 |
+
for file in files:
|
| 9 |
+
# Process the image with your AI model
|
| 10 |
+
processed_image = ai_model.predict(file)
|
| 11 |
+
processed_files.append(processed_image)
|
| 12 |
+
|
| 13 |
+
return processed_files
|
| 14 |
+
|
| 15 |
+
# Define the Gradio interface
|
| 16 |
+
iface = gr.Interface(
|
| 17 |
+
fn=process_images,
|
| 18 |
+
inputs=[
|
| 19 |
+
gr.inputs.File(multiple=True, label="Upload Blueprints"),
|
| 20 |
+
],
|
| 21 |
+
outputs=[
|
| 22 |
+
gr.outputs.Image(type="pil", multiple=True, label="Processed Blueprints"),
|
| 23 |
+
],
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
# Launch the Gradio interface
|
| 27 |
+
iface.launch()
|