orrinin commited on
Commit
b0d0c41
·
verified ·
1 Parent(s): 6a59997

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -2,6 +2,7 @@ import os
2
  import base64
3
  import gradio as gr
4
  from gradio_client import Client
 
5
 
6
  MODEL_NAME = "QWEN"
7
  client_chat = os.environ.get("CHAT_URL")
@@ -42,17 +43,14 @@ LICENSE = '采用 ' + MODEL_NAME + ' 模型'
42
 
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=str(text_input),
52
  history=None,
 
53
  api_name="/model_chat"
54
  )
55
- print(response)
56
 
57
 
58
  def encode_image_to_base64(image_input):
@@ -66,7 +64,7 @@ def process_image(image_input, unit):
66
  print(image_input)
67
  #with open(image_input, "rb") as f:
68
  # base64_image = base64.b64encode(f.read()).decode("utf-8")
69
- client = Client(client_vl)
70
  # base64_image = encode_image_to_base64(image_input)
71
  prompt = f" You are a experienced {unit} doctor AI assistant." + SYS_PROMPT + "Help me understand what is in this picture and analysis."
72
  response = client.predict(
 
2
  import base64
3
  import gradio as gr
4
  from gradio_client import Client
5
+ import json
6
 
7
  MODEL_NAME = "QWEN"
8
  client_chat = os.environ.get("CHAT_URL")
 
43
 
44
 
45
  def process_text(text_input, unit):
46
+ client = Client(client_chat,serialize=False)
 
 
 
 
47
  response = client.predict(
48
  query=str(text_input),
49
  history=None,
50
+ system=f"You are a experienced {unit} doctor AI assistant." + SYS_PROMPT,
51
  api_name="/model_chat"
52
  )
53
+ return response[1][0]
54
 
55
 
56
  def encode_image_to_base64(image_input):
 
64
  print(image_input)
65
  #with open(image_input, "rb") as f:
66
  # base64_image = base64.b64encode(f.read()).decode("utf-8")
67
+ client = Client(client_vl,serialize=False)
68
  # base64_image = encode_image_to_base64(image_input)
69
  prompt = f" You are a experienced {unit} doctor AI assistant." + SYS_PROMPT + "Help me understand what is in this picture and analysis."
70
  response = client.predict(