yonikremer
commited on
Commit
•
bf8a943
1
Parent(s):
5967916
changed minimum number of likes and downloads to 1
Browse files- hanlde_form_submit.py +8 -5
hanlde_form_submit.py
CHANGED
@@ -9,7 +9,10 @@ from prompt_engeneering import rewrite_prompt
|
|
9 |
from supported_models import get_supported_model_names
|
10 |
|
11 |
|
12 |
-
SUPPORTED_MODEL_NAMES = get_supported_model_names(
|
|
|
|
|
|
|
13 |
|
14 |
|
15 |
def is_downloaded(model_name: str) -> bool:
|
@@ -36,7 +39,7 @@ def create_pipeline(model_name: str, group_size: int) -> GroupedSamplingPipeLine
|
|
36 |
download_repository(model_name)
|
37 |
download_repository_end_time = time()
|
38 |
download_time = download_repository_end_time - download_repository_start_time
|
39 |
-
st.write(f"Finished downloading model: {model_name} from the internet in {download_time} seconds.")
|
40 |
st.write(f"Starts creating pipeline with model: {model_name}")
|
41 |
pipeline_start_time = time()
|
42 |
pipeline = GroupedSamplingPipeLine(
|
@@ -48,7 +51,7 @@ def create_pipeline(model_name: str, group_size: int) -> GroupedSamplingPipeLine
|
|
48 |
)
|
49 |
pipeline_end_time = time()
|
50 |
pipeline_time = pipeline_end_time - pipeline_start_time
|
51 |
-
st.write(f"Finished creating pipeline with model: {model_name} in {pipeline_time} seconds.")
|
52 |
return pipeline
|
53 |
|
54 |
|
@@ -100,7 +103,7 @@ def on_form_submit(model_name: str, output_length: int, prompt: str) -> str:
|
|
100 |
)
|
101 |
loading_end_time = time()
|
102 |
loading_time = loading_end_time - loading_start_time
|
103 |
-
st.write(f"Finished loading model: {model_name} in {loading_time} seconds.")
|
104 |
st.write(f"Generating text...")
|
105 |
generation_start_time = time()
|
106 |
generated_text = generate_text(
|
@@ -110,7 +113,7 @@ def on_form_submit(model_name: str, output_length: int, prompt: str) -> str:
|
|
110 |
)
|
111 |
generation_end_time = time()
|
112 |
generation_time = generation_end_time - generation_start_time
|
113 |
-
st.write(f"Finished generating text in {generation_time} seconds.")
|
114 |
if not isinstance(generated_text, str):
|
115 |
raise RuntimeError(f"The model {model_name} did not generate any text.")
|
116 |
if len(generated_text) == 0:
|
|
|
9 |
from supported_models import get_supported_model_names
|
10 |
|
11 |
|
12 |
+
SUPPORTED_MODEL_NAMES = get_supported_model_names(
|
13 |
+
min_number_of_downloads=1,
|
14 |
+
min_number_of_likes=1,
|
15 |
+
)
|
16 |
|
17 |
|
18 |
def is_downloaded(model_name: str) -> bool:
|
|
|
39 |
download_repository(model_name)
|
40 |
download_repository_end_time = time()
|
41 |
download_time = download_repository_end_time - download_repository_start_time
|
42 |
+
st.write(f"Finished downloading model: {model_name} from the internet in {download_time:,.2f} seconds.")
|
43 |
st.write(f"Starts creating pipeline with model: {model_name}")
|
44 |
pipeline_start_time = time()
|
45 |
pipeline = GroupedSamplingPipeLine(
|
|
|
51 |
)
|
52 |
pipeline_end_time = time()
|
53 |
pipeline_time = pipeline_end_time - pipeline_start_time
|
54 |
+
st.write(f"Finished creating pipeline with model: {model_name} in {pipeline_time:,.2f} seconds.")
|
55 |
return pipeline
|
56 |
|
57 |
|
|
|
103 |
)
|
104 |
loading_end_time = time()
|
105 |
loading_time = loading_end_time - loading_start_time
|
106 |
+
st.write(f"Finished loading model: {model_name} in {loading_time:,.2f} seconds.")
|
107 |
st.write(f"Generating text...")
|
108 |
generation_start_time = time()
|
109 |
generated_text = generate_text(
|
|
|
113 |
)
|
114 |
generation_end_time = time()
|
115 |
generation_time = generation_end_time - generation_start_time
|
116 |
+
st.write(f"Finished generating text in {generation_time:,.2f} seconds.")
|
117 |
if not isinstance(generated_text, str):
|
118 |
raise RuntimeError(f"The model {model_name} did not generate any text.")
|
119 |
if len(generated_text) == 0:
|