jykoh commited on
Commit
dda3162
β€’
1 Parent(s): 20a5db2

Try relative path

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -53,7 +53,7 @@ def upload_image(state, image_input):
53
  input_image = Image.open(image_input.name).resize(
54
  (224, 224)).convert('RGB')
55
  input_image.save(image_input.name) # Overwrite with smaller image.
56
- conversation += [(f'<img src="/file={image_input.name}" style="display: inline-block;">', "")]
57
  return [conversation, chat_history + [input_image, ""]], conversation
58
 
59
 
@@ -116,11 +116,11 @@ def generate_for_prompt(input_text, state, ret_scale_factor, num_words, temperat
116
  if p['decision'] is not None and p['decision'][0] == 'gen':
117
  image = p['gen'][0][0].resize((224, 224))
118
  filename = save_image_to_local(image)
119
- response += f'<img src="/file={filename}" style="display: inline-block;"><p style="font-size: 12px; color: #555;">(Generated)</p>'
120
  else:
121
  image = p['ret'][0][0].resize((224, 224))
122
  filename = save_image_to_local(image)
123
- response += f'<img src="/file={filename}" style="display: inline-block;"><p style="font-size: 12px; color: #555;">(Retrieved)</p>'
124
 
125
 
126
  chat_history = model_inputs + \
 
53
  input_image = Image.open(image_input.name).resize(
54
  (224, 224)).convert('RGB')
55
  input_image.save(image_input.name) # Overwrite with smaller image.
56
+ conversation += [(f'<img src="./file={image_input.name}" style="display: inline-block;">', "")]
57
  return [conversation, chat_history + [input_image, ""]], conversation
58
 
59
 
 
116
  if p['decision'] is not None and p['decision'][0] == 'gen':
117
  image = p['gen'][0][0].resize((224, 224))
118
  filename = save_image_to_local(image)
119
+ response += f'<img src="./file={filename}" style="display: inline-block;"><p style="font-size: 12px; color: #555;">(Generated)</p>'
120
  else:
121
  image = p['ret'][0][0].resize((224, 224))
122
  filename = save_image_to_local(image)
123
+ response += f'<img src="./file={filename}" style="display: inline-block;"><p style="font-size: 12px; color: #555;">(Retrieved)</p>'
124
 
125
 
126
  chat_history = model_inputs + \