Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -120,14 +120,14 @@ def generate(prompt,history,mod=2,tok=4000,seed=1,role="ASSISTANT",data=None):
|
|
| 120 |
#jobj.close()
|
| 121 |
#chat_im_out=chat_img(output)
|
| 122 |
|
| 123 |
-
def gen_im(prompt,seed):
|
| 124 |
print('generating image')
|
| 125 |
image_out = im_client.text_to_image(prompt=prompt['text'],height=128,width=128,num_inference_steps=10,seed=seed)
|
| 126 |
#print(type(image_out))
|
| 127 |
output=f'images/{uuid.uuid4()}.png'
|
| 128 |
image_out.save(output)
|
| 129 |
print('Done: ',output)
|
| 130 |
-
return [{'role':'assistant','content': {'path':output}}]
|
| 131 |
|
| 132 |
def build_space(repo_name,file_name,file_content,access_token=""):
|
| 133 |
try:
|
|
@@ -200,8 +200,8 @@ def agent(prompt_in,history,mod=2):
|
|
| 200 |
build_space(out_w[0],out_w[1],out_w[2])
|
| 201 |
elif 'IMAGE' in fn:
|
| 202 |
print('IMAGE called')
|
| 203 |
-
out_im=gen_im(prompt,seed)
|
| 204 |
-
yield [{'role':'assistant','content': out_im}]
|
| 205 |
elif 'SEARCH' in fn:
|
| 206 |
print('SEARCH called')
|
| 207 |
elif 'COMPLETE' in fn:
|
|
|
|
| 120 |
#jobj.close()
|
| 121 |
#chat_im_out=chat_img(output)
|
| 122 |
|
| 123 |
+
'''def gen_im(prompt,seed):
|
| 124 |
print('generating image')
|
| 125 |
image_out = im_client.text_to_image(prompt=prompt['text'],height=128,width=128,num_inference_steps=10,seed=seed)
|
| 126 |
#print(type(image_out))
|
| 127 |
output=f'images/{uuid.uuid4()}.png'
|
| 128 |
image_out.save(output)
|
| 129 |
print('Done: ',output)
|
| 130 |
+
return [{'role':'assistant','content': {'path':output}}]'''
|
| 131 |
|
| 132 |
def build_space(repo_name,file_name,file_content,access_token=""):
|
| 133 |
try:
|
|
|
|
| 200 |
build_space(out_w[0],out_w[1],out_w[2])
|
| 201 |
elif 'IMAGE' in fn:
|
| 202 |
print('IMAGE called')
|
| 203 |
+
#out_im=gen_im(prompt,seed)
|
| 204 |
+
#yield [{'role':'assistant','content': out_im}]
|
| 205 |
elif 'SEARCH' in fn:
|
| 206 |
print('SEARCH called')
|
| 207 |
elif 'COMPLETE' in fn:
|