2222included in a separate file because of the above-mentioned dependency.
2323"""
2424
25- # Mark the whole module as flaky
26- pytestmark = pytest .mark .flaky
25+ # Mark the whole module as flaky and serial
26+ pytestmark = [ pytest .mark .flaky , pytest . mark . serial ]
2727
2828os .environ ["GRADIO_ANALYTICS_ENABLED" ] = "False"
2929
@@ -72,7 +72,7 @@ def test_text_generation(self):
7272 def test_summarization (self ):
7373 model_type = "summarization"
7474 interface = gr .load (
75- "models/facebook/bart-large-cnn" , hf_token = HF_TOKEN , alias = model_type
75+ "models/facebook/bart-large-cnn" , token = HF_TOKEN , alias = model_type
7676 )
7777 assert interface .__name__ == model_type
7878 assert interface .input_components and interface .output_components
@@ -82,7 +82,7 @@ def test_summarization(self):
8282 def test_translation (self ):
8383 model_type = "translation"
8484 interface = gr .load (
85- "models/facebook/bart-large-cnn" , hf_token = HF_TOKEN , alias = model_type
85+ "models/facebook/bart-large-cnn" , token = HF_TOKEN , alias = model_type
8686 )
8787 assert interface .__name__ == model_type
8888 assert interface .input_components and interface .output_components
@@ -93,7 +93,7 @@ def test_text_classification(self):
9393 model_type = "text-classification"
9494 interface = gr .load (
9595 "models/distilbert-base-uncased-finetuned-sst-2-english" ,
96- hf_token = HF_TOKEN ,
96+ token = HF_TOKEN ,
9797 alias = model_type ,
9898 )
9999 assert interface .__name__ == model_type
@@ -104,7 +104,7 @@ def test_text_classification(self):
104104 def test_fill_mask (self ):
105105 model_type = "fill-mask"
106106 interface = gr .load (
107- "models/bert-base-uncased" , hf_token = HF_TOKEN , alias = model_type
107+ "models/bert-base-uncased" , token = HF_TOKEN , alias = model_type
108108 )
109109 assert interface .__name__ == model_type
110110 assert interface .input_components and interface .output_components
@@ -114,7 +114,7 @@ def test_fill_mask(self):
114114 def test_zero_shot_classification (self ):
115115 model_type = "zero-shot-classification"
116116 interface = gr .load (
117- "models/facebook/bart-large-mnli" , hf_token = HF_TOKEN , alias = model_type
117+ "models/facebook/bart-large-mnli" , token = HF_TOKEN , alias = model_type
118118 )
119119 assert interface .__name__ == model_type
120120 assert interface .input_components and interface .output_components
@@ -126,7 +126,7 @@ def test_zero_shot_classification(self):
126126 def test_automatic_speech_recognition (self ):
127127 model_type = "automatic-speech-recognition"
128128 interface = gr .load (
129- "models/facebook/wav2vec2-base-960h" , hf_token = HF_TOKEN , alias = model_type
129+ "models/facebook/wav2vec2-base-960h" , token = HF_TOKEN , alias = model_type
130130 )
131131 assert interface .__name__ == model_type
132132 assert interface .input_components and interface .output_components
@@ -136,7 +136,7 @@ def test_automatic_speech_recognition(self):
136136 def test_image_classification (self ):
137137 model_type = "image-classification"
138138 interface = gr .load (
139- "models/google/vit-base-patch16-224" , hf_token = HF_TOKEN , alias = model_type
139+ "models/google/vit-base-patch16-224" , token = HF_TOKEN , alias = model_type
140140 )
141141 assert interface .__name__ == model_type
142142 assert interface .input_components and interface .output_components
@@ -147,7 +147,7 @@ def test_feature_extraction(self):
147147 model_type = "feature-extraction"
148148 interface = gr .load (
149149 "models/sentence-transformers/distilbert-base-nli-mean-tokens" ,
150- hf_token = HF_TOKEN ,
150+ token = HF_TOKEN ,
151151 alias = model_type ,
152152 )
153153 assert interface .__name__ == model_type
@@ -159,7 +159,7 @@ def test_sentence_similarity(self):
159159 model_type = "text-to-speech"
160160 interface = gr .load (
161161 "models/julien-c/ljspeech_tts_train_tacotron2_raw_phn_tacotron_g2p_en_no_space_train" ,
162- hf_token = HF_TOKEN ,
162+ token = HF_TOKEN ,
163163 alias = model_type ,
164164 )
165165 assert interface .__name__ == model_type
@@ -171,7 +171,7 @@ def test_text_to_speech(self):
171171 model_type = "text-to-speech"
172172 interface = gr .load (
173173 "models/julien-c/ljspeech_tts_train_tacotron2_raw_phn_tacotron_g2p_en_no_space_train" ,
174- hf_token = HF_TOKEN ,
174+ token = HF_TOKEN ,
175175 alias = model_type ,
176176 )
177177 assert interface .__name__ == model_type
@@ -187,7 +187,7 @@ def test_multiple_spaces_one_private(self):
187187 with gr .Blocks ():
188188 gr .load (
189189 "spaces/gradio-tests/not-actually-private-spacev4-sse" ,
190- hf_token = HF_TOKEN ,
190+ token = HF_TOKEN ,
191191 )
192192 gr .load (
193193 "spaces/gradio/test-loading-examplesv4-sse" ,
@@ -197,12 +197,12 @@ def test_multiple_spaces_one_private(self):
197197 def test_private_space_v4_sse_v1 (self ):
198198 io = gr .load (
199199 "spaces/gradio-tests/not-actually-private-spacev4-sse-v1" ,
200- hf_token = HF_TOKEN ,
200+ token = HF_TOKEN ,
201201 )
202202 try :
203203 output = io ("abc" )
204204 assert output == "abc"
205- assert io .theme . name == "gradio/monochrome"
205+ assert io ._deprecated_theme == "gradio/monochrome"
206206 except TooManyRequestsError :
207207 pass
208208
@@ -227,7 +227,7 @@ def test_interface_load_cache_examples(self, tmp_path):
227227 name = "models/google/vit-base-patch16-224" ,
228228 examples = [Path (test_file_dir , "cheetah1.jpg" )],
229229 cache_examples = True ,
230- hf_token = HF_TOKEN ,
230+ token = HF_TOKEN ,
231231 )
232232 except TooManyRequestsError :
233233 pass
@@ -302,8 +302,8 @@ def check_dataframe(config):
302302 c for c in config ["components" ] if c ["props" ].get ("label" , "" ) == "Input Rows"
303303 )
304304 assert input_df ["props" ]["headers" ] == ["a" , "b" ]
305- assert input_df ["props" ]["row_count" ] == ( 1 , "dynamic" )
306- assert input_df ["props" ]["col_count" ] == ( 2 , "fixed" )
305+ assert input_df ["props" ]["row_count" ] == [ 3 , "dynamic" ]
306+ assert input_df ["props" ]["col_count" ] == [ 2 , "dynamic" ]
307307
308308
309309def check_dataset (config , readme_examples ):
@@ -352,6 +352,8 @@ def test_use_api_name_in_call_method():
352352
353353
354354def test_load_custom_component ():
355+ pytest .skip ("Custom components not supported yet" )
356+
355357 from gradio_pdf import PDF # noqa
356358
357359 demo = gr .load ("spaces/freddyaboulton/gradiopdf" )
@@ -363,7 +365,7 @@ def test_load_custom_component():
363365
364366def test_load_inside_blocks ():
365367 demo = gr .load ("spaces/abidlabs/en2fr" )
366- output = demo ("Hello" )
368+ output = demo ("Hello" , api_name = "predict" )
367369 assert isinstance (output , str )
368370
369371
0 commit comments