Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -88,18 +88,15 @@ def run(purpose,history,model_drop):
|
|
88 |
# history = ""
|
89 |
|
90 |
#action_name, action_input = parse_action(line)
|
91 |
-
out_prompt = run_gpt(
|
92 |
-
|
93 |
-
history,
|
94 |
-
|
95 |
-
)
|
96 |
|
97 |
-
yield (
|
98 |
#out_img = infer(out_prompt)
|
99 |
model=loaded_model[int(model_drop)]
|
100 |
out_img=model(out_prompt)
|
101 |
print(out_img)
|
102 |
-
url=f'https://johann22-
|
103 |
print(url)
|
104 |
uid = uuid.uuid4()
|
105 |
#urllib.request.urlretrieve(image, 'tmp.png')
|
@@ -108,7 +105,8 @@ def run(purpose,history,model_drop):
|
|
108 |
if r.status_code == 200:
|
109 |
out = Image.open(io.BytesIO(r.content))
|
110 |
yield ([(purpose,out_prompt)],out)
|
111 |
-
|
|
|
112 |
|
113 |
|
114 |
|
@@ -130,8 +128,8 @@ with gr.Blocks() as iface:
|
|
130 |
sumbox=gr.Image(label="Image")
|
131 |
|
132 |
|
133 |
-
sub_b = submit_b.click(run, [msg,chatbot,model_drop],[
|
134 |
-
sub_e = msg.submit(run, [msg, chatbot,model_drop], [
|
135 |
stop_b.click(None,None,None, cancels=[sub_b,sub_e])
|
136 |
iface.launch()
|
137 |
'''
|
|
|
88 |
# history = ""
|
89 |
|
90 |
#action_name, action_input = parse_action(line)
|
91 |
+
out_prompt = run_gpt(purpose,history):
|
92 |
+
|
|
|
|
|
|
|
93 |
|
94 |
+
yield ([(purpose,out_prompt)],None)
|
95 |
#out_img = infer(out_prompt)
|
96 |
model=loaded_model[int(model_drop)]
|
97 |
out_img=model(out_prompt)
|
98 |
print(out_img)
|
99 |
+
url=f'https://johann22-chat-diffusion.hf.space/file={out_img}'
|
100 |
print(url)
|
101 |
uid = uuid.uuid4()
|
102 |
#urllib.request.urlretrieve(image, 'tmp.png')
|
|
|
105 |
if r.status_code == 200:
|
106 |
out = Image.open(io.BytesIO(r.content))
|
107 |
yield ([(purpose,out_prompt)],out)
|
108 |
+
else:
|
109 |
+
yield ([(purpose,"an Error occured")],None)
|
110 |
|
111 |
|
112 |
|
|
|
128 |
sumbox=gr.Image(label="Image")
|
129 |
|
130 |
|
131 |
+
sub_b = submit_b.click(run, [msg,chatbot,model_drop],[chatbot,sumbox])
|
132 |
+
sub_e = msg.submit(run, [msg, chatbot,model_drop], [chatbot,sumbox])
|
133 |
stop_b.click(None,None,None, cancels=[sub_b,sub_e])
|
134 |
iface.launch()
|
135 |
'''
|