Spaces:
Running
on
Zero
Running
on
Zero
DongfuJiang
commited on
Commit
•
e636f89
1
Parent(s):
fde38b0
udpate
Browse files- model/model_manager.py +10 -2
- serve/utils.py +1 -1
model/model_manager.py
CHANGED
@@ -22,9 +22,13 @@ class ModelManager:
|
|
22 |
return pipe
|
23 |
|
24 |
@spaces.GPU(duration=60)
|
|
|
|
|
|
|
|
|
25 |
def generate_image_ig(self, prompt, model_name):
|
26 |
pipe = self.load_model_pipe(model_name)
|
27 |
-
result = pipe
|
28 |
return result
|
29 |
|
30 |
def generate_image_ig_parallel_anony(self, prompt, model_A, model_B):
|
@@ -52,9 +56,13 @@ class ModelManager:
|
|
52 |
return results[0], results[1]
|
53 |
|
54 |
@spaces.GPU(duration=150)
|
|
|
|
|
|
|
|
|
55 |
def generate_image_ie(self, textbox_source, textbox_target, textbox_instruct, source_image, model_name):
|
56 |
pipe = self.load_model_pipe(model_name)
|
57 |
-
result = pipe(src_image = source_image, src_prompt = textbox_source, target_prompt = textbox_target, instruct_prompt = textbox_instruct)
|
58 |
return result
|
59 |
|
60 |
def generate_image_ie_parallel(self, textbox_source, textbox_target, textbox_instruct, source_image, model_A, model_B):
|
|
|
22 |
return pipe
|
23 |
|
24 |
@spaces.GPU(duration=60)
|
25 |
+
def _generate_image_ig(self, pipe, prompt, model_name):
|
26 |
+
result = pipe(prompt=prompt)
|
27 |
+
return result
|
28 |
+
|
29 |
def generate_image_ig(self, prompt, model_name):
|
30 |
pipe = self.load_model_pipe(model_name)
|
31 |
+
result = self._generate_image_ig(pipe, prompt, model_name)
|
32 |
return result
|
33 |
|
34 |
def generate_image_ig_parallel_anony(self, prompt, model_A, model_B):
|
|
|
56 |
return results[0], results[1]
|
57 |
|
58 |
@spaces.GPU(duration=150)
|
59 |
+
def _generate_image_ie(self, pipe, source_image, textbox_source, textbox_target, textbox_instruct):
|
60 |
+
result = pipe(src_image = source_image, src_prompt = textbox_source, target_prompt = textbox_target, instruct_prompt = textbox_instruct)
|
61 |
+
return result
|
62 |
+
|
63 |
def generate_image_ie(self, textbox_source, textbox_target, textbox_instruct, source_image, model_name):
|
64 |
pipe = self.load_model_pipe(model_name)
|
65 |
+
result = pipe(pipe, src_image = source_image, src_prompt = textbox_source, target_prompt = textbox_target, instruct_prompt = textbox_instruct)
|
66 |
return result
|
67 |
|
68 |
def generate_image_ie_parallel(self, textbox_source, textbox_target, textbox_instruct, source_image, model_A, model_B):
|
serve/utils.py
CHANGED
@@ -128,7 +128,7 @@ def clear_history_side_by_side_ie_anony():
|
|
128 |
def get_ip(request: gr.Request):
|
129 |
if request:
|
130 |
if "cf-connecting-ip" in request.headers:
|
131 |
-
ip = request.headers["cf-connecting-ip"]
|
132 |
else:
|
133 |
ip = request.client.host
|
134 |
else:
|
|
|
128 |
def get_ip(request: gr.Request):
|
129 |
if request:
|
130 |
if "cf-connecting-ip" in request.headers:
|
131 |
+
ip = request.headers["cf-connecting-ip"] or request.client.host
|
132 |
else:
|
133 |
ip = request.client.host
|
134 |
else:
|