Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
1354e82
1
Parent(s):
a96c50b
Added complete filepath to image
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
import sys
|
3 |
import warnings
|
4 |
import random
|
@@ -38,7 +39,7 @@ import torchvision
|
|
38 |
import gradio as gr
|
39 |
import argparse
|
40 |
from PIL import Image, ImageDraw, ImageFont
|
41 |
-
|
42 |
|
43 |
# Grounding DINO
|
44 |
import GroundingDINO.groundingdino.datasets.transforms as T
|
@@ -49,9 +50,6 @@ from GroundingDINO.groundingdino.util.utils import clean_state_dict, get_phrases
|
|
49 |
# segment anything
|
50 |
from segment_anything import build_sam_vit_l, SamPredictor
|
51 |
|
52 |
-
# # BLIP
|
53 |
-
# from transformers import BlipProcessor, BlipForConditionalGeneration
|
54 |
-
|
55 |
# Constants
|
56 |
CONFIG_FILE = 'GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py'
|
57 |
GROUNDINGDINO_CHECKPOINT = "groundingdino_swint_ogc.pth"
|
@@ -329,12 +327,12 @@ def run_grounded_sam(
|
|
329 |
return [Image.new('RGB', (400, 300), color='gray'), Image.new('RGBA', (400, 300), color=(0, 0, 0, 0))]
|
330 |
|
331 |
def generate_ai_bg(input_img, prompt):
|
332 |
-
|
333 |
handler = fal_client.submit(
|
334 |
"fal-ai/iclight-v2",
|
335 |
arguments={
|
336 |
"prompt": prompt,
|
337 |
-
"image_url":
|
338 |
},
|
339 |
webhook_url="https://optional.webhook.url/for/results",
|
340 |
)
|
|
|
1 |
import os
|
2 |
+
import shutil
|
3 |
import sys
|
4 |
import warnings
|
5 |
import random
|
|
|
39 |
import gradio as gr
|
40 |
import argparse
|
41 |
from PIL import Image, ImageDraw, ImageFont
|
42 |
+
|
43 |
|
44 |
# Grounding DINO
|
45 |
import GroundingDINO.groundingdino.datasets.transforms as T
|
|
|
50 |
# segment anything
|
51 |
from segment_anything import build_sam_vit_l, SamPredictor
|
52 |
|
|
|
|
|
|
|
53 |
# Constants
|
54 |
CONFIG_FILE = 'GroundingDINO/groundingdino/config/GroundingDINO_SwinT_OGC.py'
|
55 |
GROUNDINGDINO_CHECKPOINT = "groundingdino_swint_ogc.pth"
|
|
|
327 |
return [Image.new('RGB', (400, 300), color='gray'), Image.new('RGBA', (400, 300), color=(0, 0, 0, 0))]
|
328 |
|
329 |
def generate_ai_bg(input_img, prompt):
|
330 |
+
hf_input_img = 'https://huggingface.co/spaces/rootglitch/CarVizGradioDemo01/'+input_img
|
331 |
handler = fal_client.submit(
|
332 |
"fal-ai/iclight-v2",
|
333 |
arguments={
|
334 |
"prompt": prompt,
|
335 |
+
"image_url": hf_input_img
|
336 |
},
|
337 |
webhook_url="https://optional.webhook.url/for/results",
|
338 |
)
|