Rooni commited on
Commit
1e0b90b
·
1 Parent(s): 675b076

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -92,7 +92,9 @@ def ask_openai_with_image(instruction, image):
92
  response_json = response.json()
93
  try:
94
  # Пытаемся извлечь текст из ответа
95
- return response_json["choices"][0]["message"]["content"]
 
 
96
  except Exception as e:
97
  # Если есть ошибка в структуре JSON, выводим ее
98
  return f"Error processing the image response: {e}"
@@ -103,7 +105,7 @@ css = """
103
  footer {visibility: hidden !important;}
104
  """
105
  # Создаем интерфейс с помощью Gradio
106
- with gr.Blocks(css=css, theme='YTheme/IOS14') as demo:
107
  with gr.Row():
108
  with gr.Column():
109
  image_input = gr.Image(label="Фото", type="pil")
 
92
  response_json = response.json()
93
  try:
94
  # Пытаемся извлечь текст из ответа
95
+ otvet = response_json["choices"][0]["message"]["content"]
96
+ print(f"Генерация \"{prompt}\": {otvet}")
97
+ return otvet
98
  except Exception as e:
99
  # Если есть ошибка в структуре JSON, выводим ее
100
  return f"Error processing the image response: {e}"
 
105
  footer {visibility: hidden !important;}
106
  """
107
  # Создаем интерфейс с помощью Gradio
108
+ with gr.Blocks(css=css, theme='YTheme/KidsShool') as demo:
109
  with gr.Row():
110
  with gr.Column():
111
  image_input = gr.Image(label="Фото", type="pil")