hedtorresca commited on
Commit
2273894
·
verified ·
1 Parent(s): ce04ad4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -1,8 +1,8 @@
1
  import gradio as gr
2
  import matplotlib.pyplot as plt
3
- import numpy as np
4
  from matplotlib_venn import venn3
5
  from io import BytesIO
 
6
 
7
  def calculate_probabilities(A, B, C, AB, AC, BC, ABC):
8
  total = A + B + C - AB - AC - BC + ABC
@@ -43,8 +43,8 @@ def plot_venn(A, B, C, AB, AC, BC, ABC):
43
  buf = BytesIO()
44
  plt.savefig(buf, format='png')
45
  buf.seek(0)
46
-
47
- return buf
48
 
49
  def main(A, B, C, AB, AC, BC, ABC):
50
  venn_diagram = plot_venn(A, B, C, AB, AC, BC, ABC)
@@ -63,7 +63,7 @@ iface = gr.Interface(
63
  gr.Number(label="Cantidad en A ∩ B ∩ C")
64
  ],
65
  outputs=[
66
- gr.Image(type="plot", label="Diagrama de Venn"),
67
  gr.JSON(label="Probabilidades Calculadas")
68
  ]
69
  )
 
1
  import gradio as gr
2
  import matplotlib.pyplot as plt
 
3
  from matplotlib_venn import venn3
4
  from io import BytesIO
5
+ from PIL import Image
6
 
7
  def calculate_probabilities(A, B, C, AB, AC, BC, ABC):
8
  total = A + B + C - AB - AC - BC + ABC
 
43
  buf = BytesIO()
44
  plt.savefig(buf, format='png')
45
  buf.seek(0)
46
+ img = Image.open(buf)
47
+ return img
48
 
49
  def main(A, B, C, AB, AC, BC, ABC):
50
  venn_diagram = plot_venn(A, B, C, AB, AC, BC, ABC)
 
63
  gr.Number(label="Cantidad en A ∩ B ∩ C")
64
  ],
65
  outputs=[
66
+ gr.Image(type="pil", label="Diagrama de Venn"),
67
  gr.JSON(label="Probabilidades Calculadas")
68
  ]
69
  )