Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,6 +24,7 @@ agents =[
|
|
| 24 |
"MEME_GENERATOR",
|
| 25 |
]
|
| 26 |
def generate(prompt, history):
|
|
|
|
| 27 |
seed = random.randint(1,1111111111111111)
|
| 28 |
|
| 29 |
system_prompt=MEME_GENERATOR
|
|
@@ -63,11 +64,12 @@ def generate(prompt, history):
|
|
| 63 |
print(e)
|
| 64 |
pass
|
| 65 |
'''
|
| 66 |
-
|
| 67 |
-
if "PROMPT:" and "MEME_TEXT:" in
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
|
|
|
| 71 |
|
| 72 |
def run(inp,history,model_drop):
|
| 73 |
#if len(inp)>max_prompt:
|
|
@@ -144,8 +146,9 @@ with gr.Blocks() as app:
|
|
| 144 |
clear = gr.ClearButton([msg, chatbot])
|
| 145 |
with gr.Column(scale=2):
|
| 146 |
im_out=gr.Image(label="Image")
|
|
|
|
| 147 |
|
| 148 |
-
sub_b = submit_b.click(generate, [msg,chatbot],[chatbot])
|
| 149 |
sub_im = submit_im.click(run, [msg,chatbot,model_drop],[chatbot,im_out])
|
| 150 |
sub_e = msg.submit(run, [msg, chatbot,model_drop], [chatbot,im_out])
|
| 151 |
stop_b.click(None,None,None, cancels=[sub_b,sub_e])
|
|
|
|
| 24 |
"MEME_GENERATOR",
|
| 25 |
]
|
| 26 |
def generate(prompt, history):
|
| 27 |
+
output1={}
|
| 28 |
seed = random.randint(1,1111111111111111)
|
| 29 |
|
| 30 |
system_prompt=MEME_GENERATOR
|
|
|
|
| 64 |
print(e)
|
| 65 |
pass
|
| 66 |
'''
|
| 67 |
+
output1=output.replace("\n"," ")
|
| 68 |
+
if "PROMPT:" and "MEME_TEXT:" in output1:
|
| 69 |
+
print("YES")
|
| 70 |
+
output1={'PROMPT':output1.split("PROMPT:",1)[1].split("MEME_TEXT",1)[0],'MEME_TEXT':output1.split("MEME_TEXT",1)[1]}
|
| 71 |
+
output=str(output1)
|
| 72 |
+
return [(prompt,output)],output1
|
| 73 |
|
| 74 |
def run(inp,history,model_drop):
|
| 75 |
#if len(inp)>max_prompt:
|
|
|
|
| 146 |
clear = gr.ClearButton([msg, chatbot])
|
| 147 |
with gr.Column(scale=2):
|
| 148 |
im_out=gr.Image(label="Image")
|
| 149 |
+
json_out=gr.JSON()
|
| 150 |
|
| 151 |
+
sub_b = submit_b.click(generate, [msg,chatbot],[chatbot,json_out])
|
| 152 |
sub_im = submit_im.click(run, [msg,chatbot,model_drop],[chatbot,im_out])
|
| 153 |
sub_e = msg.submit(run, [msg, chatbot,model_drop], [chatbot,im_out])
|
| 154 |
stop_b.click(None,None,None, cancels=[sub_b,sub_e])
|