vilarin commited on
Commit
aedbb72
Β·
verified Β·
1 Parent(s): 80f6e70

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -9,8 +9,6 @@ import base64
9
  # Set API key
10
  #base_url = os.environ.get("OPENAI_API_BASE")
11
  api_key = ""
12
-
13
- endpoints = ''
14
 
15
  # Define the model to be used
16
  model_name = ""
@@ -65,8 +63,8 @@ def process_text(text_input, unit):
65
  return completion.choices[0].message.content
66
  elif text_input and endpoints == "GOOGLE":
67
  genai.configure(api_key=api_key)
68
- model = genai.GenerativeModel(model_name=model_name),
69
- prompt = f" You are a experienced {unit} doctor." + SYS_PROMPT + f"Could you solve {text_input}?",
70
  response = model.generate_content(prompt)
71
  return response.text
72
  return ""
@@ -103,8 +101,8 @@ def process_image(image_input, unit):
103
  return response.choices[0].message.content
104
  elif image_input is not None and endpoints == "GOOGLE":
105
  genai.configure(api_key=api_key)
106
- model = genai.GenerativeModel(model_name=model_name),
107
- prompt = f" You are a experienced {unit} doctor." + SYS_PROMPT + "Help me understand what is in this picture and analysis.",
108
  response = model.generate_content([prompt, image_input],request_options={"timeout": 60})
109
  return response.text
110
 
@@ -129,7 +127,7 @@ with gr.Blocks(theme='shivi/calm_seafoam', css=css, title="Medster - Medical Dia
129
  api_key = gr.Textbox(label="API Key", type='password') # Input API key
130
  with gr.Row():
131
  image_input = gr.Image(type="pil", label="Upload Image") # Create an image upload button
132
- text_input = gr.Textbox(label="Submit") # Create a text input box
133
  with gr.Row():
134
  submit_btn = gr.Button("πŸš€ Send") # Create a submit button
135
  clear_btn = gr.ClearButton(output_box, value="πŸ—‘οΈ Clear") # Create a clear button
 
9
  # Set API key
10
  #base_url = os.environ.get("OPENAI_API_BASE")
11
  api_key = ""
 
 
12
 
13
  # Define the model to be used
14
  model_name = ""
 
63
  return completion.choices[0].message.content
64
  elif text_input and endpoints == "GOOGLE":
65
  genai.configure(api_key=api_key)
66
+ model = genai.GenerativeModel(model_name=model_name)
67
+ prompt = f" You are a experienced {unit} doctor." + SYS_PROMPT + f"Could you solve {text_input}?"
68
  response = model.generate_content(prompt)
69
  return response.text
70
  return ""
 
101
  return response.choices[0].message.content
102
  elif image_input is not None and endpoints == "GOOGLE":
103
  genai.configure(api_key=api_key)
104
+ model = genai.GenerativeModel(model_name=model_name)
105
+ prompt = f" You are a experienced {unit} doctor." + SYS_PROMPT + "Help me understand what is in this picture and analysis."
106
  response = model.generate_content([prompt, image_input],request_options={"timeout": 60})
107
  return response.text
108
 
 
127
  api_key = gr.Textbox(label="API Key", type='password') # Input API key
128
  with gr.Row():
129
  image_input = gr.Image(type="pil", label="Upload Image") # Create an image upload button
130
+ text_input = gr.Textbox(label="Input Text") # Create a text input box
131
  with gr.Row():
132
  submit_btn = gr.Button("πŸš€ Send") # Create a submit button
133
  clear_btn = gr.ClearButton(output_box, value="πŸ—‘οΈ Clear") # Create a clear button