Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
|
|
2 |
from gradio_client import Client
|
3 |
from huggingface_hub import InferenceClient
|
4 |
import random
|
|
|
5 |
from models import models
|
6 |
ss_client = Client("https://omnibus-html-image-current-tab.hf.space/")
|
7 |
'''
|
@@ -16,18 +17,39 @@ models=[
|
|
16 |
"JunRyeol/jr_model",
|
17 |
]
|
18 |
'''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
def test_models():
|
20 |
log_box=[]
|
21 |
for model in models:
|
|
|
22 |
try:
|
23 |
print(f'trying: {model}\n')
|
24 |
client= InferenceClient(model)
|
25 |
outp=client.text_generation("What is a cat")
|
26 |
-
|
|
|
|
|
|
|
27 |
print(f'{log}\n')
|
28 |
log_box.append(log)
|
29 |
except Exception as e:
|
30 |
-
|
|
|
|
|
|
|
31 |
print(f'{log}\n')
|
32 |
log_box.append(log)
|
33 |
yield log_box
|
|
|
2 |
from gradio_client import Client
|
3 |
from huggingface_hub import InferenceClient
|
4 |
import random
|
5 |
+
from datetime import datetime
|
6 |
from models import models
|
7 |
ss_client = Client("https://omnibus-html-image-current-tab.hf.space/")
|
8 |
'''
|
|
|
17 |
"JunRyeol/jr_model",
|
18 |
]
|
19 |
'''
|
20 |
+
|
21 |
+
from datetime import datetime
|
22 |
+
|
23 |
+
start_time = datetime.now()
|
24 |
+
print(start_time)
|
25 |
+
|
26 |
+
while not buff.endswith('/abc #'):
|
27 |
+
print('waiting')
|
28 |
+
time_delta = datetime.now() - start_time
|
29 |
+
print(time_delta)
|
30 |
+
if time_delta.total_seconds() >= 10:
|
31 |
+
break
|
32 |
+
|
33 |
+
|
34 |
def test_models():
|
35 |
log_box=[]
|
36 |
for model in models:
|
37 |
+
start_time = datetime.now()
|
38 |
try:
|
39 |
print(f'trying: {model}\n')
|
40 |
client= InferenceClient(model)
|
41 |
outp=client.text_generation("What is a cat")
|
42 |
+
time_delta = datetime.now() - start_time
|
43 |
+
count=time_delta.total_seconds()
|
44 |
+
#if time_delta.total_seconds() >= 180:
|
45 |
+
log = {"Model":model,"Status":"Success","Output":outp, "Time":count}
|
46 |
print(f'{log}\n')
|
47 |
log_box.append(log)
|
48 |
except Exception as e:
|
49 |
+
time_delta = datetime.now() - start_time
|
50 |
+
count=time_delta.total_seconds()
|
51 |
+
|
52 |
+
log = {"Model":model,"Status":"Error","Output":e,"Time":count}
|
53 |
print(f'{log}\n')
|
54 |
log_box.append(log)
|
55 |
yield log_box
|