Omnibus commited on
Commit
d329dae
·
verified ·
1 Parent(s): 950951e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -67,19 +67,20 @@ def generate(prompt, history):
67
  output1=output.replace("\n"," ")
68
  if "PROMPT:" and "MEME_TEXT:" in output1:
69
  print("YES")
70
- prompt_t=output1.split("PROMPT:",1)[1].split("MEME_TEXT:",1)[0]
71
  print(prompt_t)
72
- meme_t=output1.split("MEME_TEXT",1)[1]
73
  print(meme_t)
74
  output1={'PROMPT':prompt_t,'MEME_TEXT':meme_t}
75
- output=str(output1)
76
  yield [(prompt,output)],output1
77
 
78
- def run(inp,history,model_drop):
 
79
  #if len(inp)>max_prompt:
80
  # inp = condense(inp)
81
  print(f'history :: {history}')
82
- prompt=format_prompt(inp,history)
83
  seed = random.randint(1,1111111111111111)
84
  print (seed)
85
  generate_kwargs = dict(
@@ -153,7 +154,7 @@ with gr.Blocks() as app:
153
  json_out=gr.JSON()
154
 
155
  sub_b = submit_b.click(generate, [msg,chatbot],[chatbot,json_out])
156
- sub_im = submit_im.click(run, [msg,chatbot,model_drop],[chatbot,im_out])
157
  sub_e = msg.submit(run, [msg, chatbot,model_drop], [chatbot,im_out])
158
  stop_b.click(None,None,None, cancels=[sub_b,sub_e])
159
  app.launch()
 
67
  output1=output.replace("\n"," ")
68
  if "PROMPT:" and "MEME_TEXT:" in output1:
69
  print("YES")
70
+ prompt_t=output1.split("PROMPT:",1)[1].split("MEME_TEXT:",1)[0].strip()
71
  print(prompt_t)
72
+ meme_t=output1.split("MEME_TEXT:",1)[1].strip()
73
  print(meme_t)
74
  output1={'PROMPT':prompt_t,'MEME_TEXT':meme_t}
75
+ #output=str(output1)
76
  yield [(prompt,output)],output1
77
 
78
+ def run(inp,model_drop):
79
+ prompt=inp['PROMPT']
80
  #if len(inp)>max_prompt:
81
  # inp = condense(inp)
82
  print(f'history :: {history}')
83
+ #prompt=format_prompt(inp,history)
84
  seed = random.randint(1,1111111111111111)
85
  print (seed)
86
  generate_kwargs = dict(
 
154
  json_out=gr.JSON()
155
 
156
  sub_b = submit_b.click(generate, [msg,chatbot],[chatbot,json_out])
157
+ sub_im = submit_im.click(run, [json_out,model_drop],[chatbot,im_out])
158
  sub_e = msg.submit(run, [msg, chatbot,model_drop], [chatbot,im_out])
159
  stop_b.click(None,None,None, cancels=[sub_b,sub_e])
160
  app.launch()