orrinin commited on
Commit
47f1619
·
verified ·
1 Parent(s): d30aa5d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -53,6 +53,7 @@ def endpoints(api_key):
53
  return 'GOOGLE'
54
 
55
  def process_text(text_input, unit):
 
56
  endpoint = endpoints(api_key)
57
  if text_input and endpoint == 'OPENAI':
58
  client = OpenAI(api_key=api_key)
@@ -103,6 +104,7 @@ def process_image(image_input, unit):
103
  )
104
  return response.choices[0].message.content
105
  elif image_input is not None and endpoint == 'GOOGLE':
 
106
  genai.configure(api_key=api_key)
107
  model = genai.GenerativeModel(model_name=MODEL)
108
  prompt = f" You are a experienced Analyst in {unit}." + SYS_PROMPT + "Help me understand what is in this picture and analysis it."
@@ -112,10 +114,8 @@ def process_image(image_input, unit):
112
 
113
  def main(text_input="", image_input=None, unit=""):
114
  if text_input and image_input is None:
115
- print(text_input)
116
  return process_text(text_input,unit)
117
  elif image_input is not None:
118
- print(image_input)
119
  return process_image(image_input,unit)
120
  else:
121
  gr.Error("请输入内容或者上传图片")
 
53
  return 'GOOGLE'
54
 
55
  def process_text(text_input, unit):
56
+ print(text_input)
57
  endpoint = endpoints(api_key)
58
  if text_input and endpoint == 'OPENAI':
59
  client = OpenAI(api_key=api_key)
 
104
  )
105
  return response.choices[0].message.content
106
  elif image_input is not None and endpoint == 'GOOGLE':
107
+ print(image_input)
108
  genai.configure(api_key=api_key)
109
  model = genai.GenerativeModel(model_name=MODEL)
110
  prompt = f" You are a experienced Analyst in {unit}." + SYS_PROMPT + "Help me understand what is in this picture and analysis it."
 
114
 
115
  def main(text_input="", image_input=None, unit=""):
116
  if text_input and image_input is None:
 
117
  return process_text(text_input,unit)
118
  elif image_input is not None:
 
119
  return process_image(image_input,unit)
120
  else:
121
  gr.Error("请输入内容或者上传图片")