Spaces:
Running
Running
Commit
·
a1599a6
1
Parent(s):
4cdc4e2
updated gradio to call the functions directly
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import pandas as pd
|
|
5 |
import matplotlib.pyplot as plt
|
6 |
import time
|
7 |
import io
|
|
|
8 |
|
9 |
def analyze_file(file, progress=gr.Progress(track_tqdm=True)):
|
10 |
start_time = time.time()
|
@@ -28,10 +29,11 @@ def analyze_file(file, progress=gr.Progress(track_tqdm=True)):
|
|
28 |
plt.savefig(buf, format='png')
|
29 |
buf.seek(0)
|
30 |
plt.close(fig)
|
|
|
31 |
progress(1, desc="Done!")
|
32 |
elapsed = time.time() - start_time
|
33 |
preview = df.head().to_csv(index=False)
|
34 |
-
return preview, csv_path,
|
35 |
|
36 |
iface = gr.Interface(
|
37 |
fn=analyze_file,
|
|
|
5 |
import matplotlib.pyplot as plt
|
6 |
import time
|
7 |
import io
|
8 |
+
from PIL import Image
|
9 |
|
10 |
def analyze_file(file, progress=gr.Progress(track_tqdm=True)):
|
11 |
start_time = time.time()
|
|
|
29 |
plt.savefig(buf, format='png')
|
30 |
buf.seek(0)
|
31 |
plt.close(fig)
|
32 |
+
img = Image.open(buf)
|
33 |
progress(1, desc="Done!")
|
34 |
elapsed = time.time() - start_time
|
35 |
preview = df.head().to_csv(index=False)
|
36 |
+
return preview, csv_path, img, f"Analysis completed in {elapsed:.2f} seconds."
|
37 |
|
38 |
iface = gr.Interface(
|
39 |
fn=analyze_file,
|