Update app.py
Browse files
app.py
CHANGED
@@ -44,24 +44,25 @@ LICENSE = '采用 ' + MODEL_NAME + ' 模型'
|
|
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 |
-
|
54 |
-
response = job.result(timeout=30)
|
55 |
print(response)
|
56 |
return response[1][0][0]
|
57 |
|
58 |
def process_image(image_input, unit):
|
59 |
if image_input is not None:
|
60 |
-
image =
|
61 |
print(image_input,image)
|
62 |
#with open(image_input, "rb") as f:
|
63 |
# base64_image = base64.b64encode(f.read()).decode("utf-8")
|
64 |
client = Client(client_vl)
|
|
|
65 |
prompt = f" You are a experienced {unit} doctor AI assistant." + SYS_PROMPT + "Help me understand what is in this picture and analysis."
|
66 |
response = client.predict(
|
67 |
image,
|
|
|
44 |
|
45 |
def process_text(text_input, unit):
|
46 |
client = Client(client_chat)
|
47 |
+
print(client.view_api())
|
48 |
job = client.submit(
|
49 |
query=str(text_input),
|
50 |
history=None,
|
51 |
system=f"You are a experienced {unit} doctor AI assistant." + SYS_PROMPT,
|
52 |
api_name="/model_chat"
|
53 |
)
|
54 |
+
response = job.result(timeout=60)
|
|
|
55 |
print(response)
|
56 |
return response[1][0][0]
|
57 |
|
58 |
def process_image(image_input, unit):
|
59 |
if image_input is not None:
|
60 |
+
image = str(image_input)
|
61 |
print(image_input,image)
|
62 |
#with open(image_input, "rb") as f:
|
63 |
# base64_image = base64.b64encode(f.read()).decode("utf-8")
|
64 |
client = Client(client_vl)
|
65 |
+
print(client.view_api())
|
66 |
prompt = f" You are a experienced {unit} doctor AI assistant." + SYS_PROMPT + "Help me understand what is in this picture and analysis."
|
67 |
response = client.predict(
|
68 |
image,
|