Rooni commited on
Commit
757f1cf
·
1 Parent(s): 7717b35

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -9,8 +9,9 @@ def gpt3_turbo(image=None, text=None):
9
 
10
  # Формируем данные для отправки запроса
11
  data = {}
12
- if image:
13
- data['image'] = image
 
14
  if text:
15
  data['text'] = text
16
 
@@ -31,7 +32,10 @@ def gpt3_turbo(image=None, text=None):
31
  # Создаем интерфейс Gradio
32
  iface = gr.Interface(
33
  fn=gpt3_turbo,
34
- inputs=["text", "text"],
 
 
 
35
  outputs="text",
36
  title="GPT",
37
  description="Помощь ученикам, решение заданий"
 
9
 
10
  # Формируем данные для отправки запроса
11
  data = {}
12
+ if image is not None:
13
+ with open(image.name, "rb") as img_file:
14
+ data['image'] = img_file.read()
15
  if text:
16
  data['text'] = text
17
 
 
32
  # Создаем интерфейс Gradio
33
  iface = gr.Interface(
34
  fn=gpt3_turbo,
35
+ inputs=[
36
+ gr.inputs.Image(type="file", label="Выберите изображение (необязательно)"),
37
+ "text"
38
+ ],
39
  outputs="text",
40
  title="GPT",
41
  description="Помощь ученикам, решение заданий"