Update app.py
Browse files
app.py
CHANGED
@@ -44,13 +44,16 @@ LICENSE = '采用 ' + MODEL_NAME + ' 模型'
|
|
44 |
|
45 |
def process_text(text_input, unit):
|
46 |
client = Client(client_chat)
|
47 |
-
|
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 |
-
|
|
|
|
|
|
|
54 |
|
55 |
def encode_image_to_base64(image_input):
|
56 |
buffered = io.BytesIO()
|
@@ -63,7 +66,7 @@ def process_image(image_input, unit):
|
|
63 |
print(image_input)
|
64 |
#with open(image_input, "rb") as f:
|
65 |
# base64_image = base64.b64encode(f.read()).decode("utf-8")
|
66 |
-
client = Client(client_vl
|
67 |
# base64_image = encode_image_to_base64(image_input)
|
68 |
prompt = f" You are a experienced {unit} doctor AI assistant." + SYS_PROMPT + "Help me understand what is in this picture and analysis."
|
69 |
client.predict(
|
|
|
44 |
|
45 |
def process_text(text_input, unit):
|
46 |
client = Client(client_chat)
|
47 |
+
job = client.submit(
|
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 |
+
print(job)
|
54 |
+
response = job.result()
|
55 |
+
print(response)
|
56 |
+
print response[1][0]
|
57 |
|
58 |
def encode_image_to_base64(image_input):
|
59 |
buffered = io.BytesIO()
|
|
|
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 |
client.predict(
|