orrinin commited on
Commit
20dc247
·
verified ·
1 Parent(s): 3dc387b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -43,9 +43,12 @@ LICENSE = '采用 ' + MODEL_NAME + ' 模型'
43
 
44
  def process_text(text_input, unit):
45
  client = Client(client_chat)
 
 
 
 
46
  response = client.predict(
47
  query=text_input,
48
- system = f" You are a experienced {unit} doctor AI assistant." + SYS_PROMPT,
49
  api_name="/model_chat"
50
  )
51
  return response[1]
@@ -60,13 +63,13 @@ def encode_image_to_base64(image_input):
60
  def process_image(image_input, unit):
61
  if image_input is not None:
62
  print(image_input)
63
- #with open(image_input.name, "rb") as f:
64
- # base64_image = base64.b64encode(f.read()).decode("utf-8")
65
  client = Client(client_vl)
66
  # base64_image = encode_image_to_base64(image_input)
67
  prompt = f" You are a experienced {unit} doctor AI assistant." + SYS_PROMPT + "Help me understand what is in this picture and analysis."
68
  response = client.predict(
69
- image_input,
70
  prompt,
71
  fn_index=0
72
  )
 
43
 
44
  def process_text(text_input, unit):
45
  client = Client(client_chat)
46
+ client.predict(
47
+ system=f" You are a experienced {unit} doctor AI assistant." + SYS_PROMPT,
48
+ api_name="/modify_system_session"
49
+ )
50
  response = client.predict(
51
  query=text_input,
 
52
  api_name="/model_chat"
53
  )
54
  return response[1]
 
63
  def process_image(image_input, unit):
64
  if image_input is not None:
65
  print(image_input)
66
+ with open(image_input, "rb") as f:
67
+ base64_image = base64.b64encode(f.read()).decode("utf-8")
68
  client = Client(client_vl)
69
  # base64_image = encode_image_to_base64(image_input)
70
  prompt = f" You are a experienced {unit} doctor AI assistant." + SYS_PROMPT + "Help me understand what is in this picture and analysis."
71
  response = client.predict(
72
+ base64_image,
73
  prompt,
74
  fn_index=0
75
  )