Spaces:
Runtime error
Runtime error
upd
Browse files
app.py
CHANGED
@@ -4,6 +4,8 @@ import requests
|
|
4 |
import time
|
5 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
6 |
import paddlehub as hub
|
|
|
|
|
7 |
|
8 |
HF_TOKEN = os.environ["HF_TOKEN"]
|
9 |
model = hub.Module(name='ernie_vilg')
|
@@ -39,6 +41,11 @@ def get_sd(translated_txt, samples, steps, scale, seed):
|
|
39 |
print(f"translated_txt is : {translated_txt}")
|
40 |
sd_img_gallery = sd_inf(translated_txt, samples, steps, scale, seed, fn_index=1)[0]
|
41 |
|
|
|
|
|
|
|
|
|
|
|
42 |
return sd_img_gallery
|
43 |
|
44 |
demo = gr.Blocks()
|
|
|
4 |
import time
|
5 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, pipeline
|
6 |
import paddlehub as hub
|
7 |
+
# Importing the essential libraries for monitoring
|
8 |
+
import psutil
|
9 |
|
10 |
HF_TOKEN = os.environ["HF_TOKEN"]
|
11 |
model = hub.Module(name='ernie_vilg')
|
|
|
41 |
print(f"translated_txt is : {translated_txt}")
|
42 |
sd_img_gallery = sd_inf(translated_txt, samples, steps, scale, seed, fn_index=1)[0]
|
43 |
|
44 |
+
#for CPU monitoring
|
45 |
+
# Testing the psutil library for both CPU and RAM performance details
|
46 |
+
print(f"CPU percent is: {psutil.cpu_percent()}")
|
47 |
+
print(f"virtual memory is : {psutil.virtual_memory().percent}")
|
48 |
+
|
49 |
return sd_img_gallery
|
50 |
|
51 |
demo = gr.Blocks()
|