hsienchen commited on
Commit
2c2c7d0
·
verified ·
1 Parent(s): 578c86f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -65,22 +65,25 @@ def app2_response(history,text,img):
65
 
66
  def app1_query(img):
67
  if not img:
68
- return txt_prompt_1
 
69
  base64 = image_to_base64(img)
70
  data_url = f"data:image/jpeg;base64,{base64}"
71
- outputText = [(f"{txt_display_1} ![]({data_url})", None)]
72
- return outputText
73
 
74
  # Function that takes User Inputs, generates Response and displays on Chat UI
75
  def app1_response(img):
76
  if not img:
77
  response = txt_model.generate_content(txt_prompt_1)
78
- return response
 
79
 
80
  else:
81
  img = PIL.Image.open(img)
82
  response = vis_model.generate_content([txt_prompt_1,img])
83
- return response.text
 
84
 
85
 
86
  # Interface Code- Selector method
 
65
 
66
  def app1_query(img):
67
  if not img:
68
+ history += [(txt_prompt_1,None)]
69
+ return history
70
  base64 = image_to_base64(img)
71
  data_url = f"data:image/jpeg;base64,{base64}"
72
+ history += [(f" ![]({data_url})", None)]
73
+ return history
74
 
75
  # Function that takes User Inputs, generates Response and displays on Chat UI
76
  def app1_response(img):
77
  if not img:
78
  response = txt_model.generate_content(txt_prompt_1)
79
+ history += [(None,response.text)]
80
+ return history
81
 
82
  else:
83
  img = PIL.Image.open(img)
84
  response = vis_model.generate_content([txt_prompt_1,img])
85
+ history += [(None,response.text)]
86
+ return history
87
 
88
 
89
  # Interface Code- Selector method