Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -57,16 +57,24 @@ def run(purpose,history,model_drop):
|
|
57 |
history=str(history).strip("[]")
|
58 |
if not history:
|
59 |
history = ""
|
60 |
-
|
|
|
|
|
|
|
61 |
yield ("",[(purpose,out_prompt)],None)
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
69 |
#return ("", [(purpose,history)])
|
|
|
70 |
|
71 |
|
72 |
|
|
|
57 |
history=str(history).strip("[]")
|
58 |
if not history:
|
59 |
history = ""
|
60 |
+
try:
|
61 |
+
out_prompt = run_gpt(purpose,history)
|
62 |
+
except Exception as e:
|
63 |
+
out_prompt = f"An Error Occured generating the prompt \n {e}"
|
64 |
yield ("",[(purpose,out_prompt)],None)
|
65 |
+
try:
|
66 |
+
model=loaded_model[int(model_drop)]
|
67 |
+
out_img=model(out_prompt)
|
68 |
+
print(out_img)
|
69 |
+
image=f'{base_url}file={out_img}'
|
70 |
+
uid = uuid.uuid4()
|
71 |
+
urllib.request.urlretrieve(image, f'{uid}.png')
|
72 |
+
return ("",[(purpose,out_prompt)],f'{uid}.png')
|
73 |
+
|
74 |
+
except Exception as e:
|
75 |
+
print (e)
|
76 |
#return ("", [(purpose,history)])
|
77 |
+
return ("An Error Occured generating the image",[(purpose,out_prompt)],None)
|
78 |
|
79 |
|
80 |
|