Tom Aarsen commited on
Commit
4ae3864
·
1 Parent(s): 3921dd6

Add ZeroGPU support

Browse files
Files changed (2) hide show
  1. app.py +6 -0
  2. requirements.txt +1 -0
app.py CHANGED
@@ -4,6 +4,7 @@ import json
4
  from pathlib import Path
5
  from typing import Optional, Tuple
6
  import gradio as gr
 
7
  from gradio_huggingfacehub_search import HuggingfaceHubSearch
8
  import huggingface_hub
9
  from sentence_transformers import CrossEncoder, SentenceTransformer, SparseEncoder
@@ -150,6 +151,7 @@ def export_to_torch(model_id, create_pr, output_model_id):
150
  )
151
 
152
 
 
153
  def export_to_onnx(
154
  model_id: str,
155
  archetype: Archetype,
@@ -287,6 +289,7 @@ predictions = model.predict([
287
  )
288
 
289
 
 
290
  def export_to_onnx_dynamic_quantization(
291
  model_id: str,
292
  archetype: Archetype,
@@ -420,6 +423,7 @@ predictions = model.predict([
420
  )
421
 
422
 
 
423
  def export_to_onnx_optimization(
424
  model_id: str,
425
  archetype: Archetype,
@@ -530,6 +534,7 @@ predictions = model.predict([
530
  )
531
 
532
 
 
533
  def export_to_openvino(
534
  model_id: str,
535
  archetype: Archetype,
@@ -665,6 +670,7 @@ predictions = model.predict([
665
  )
666
 
667
 
 
668
  def export_to_openvino_static_quantization(
669
  model_id: str,
670
  archetype: Archetype,
 
4
  from pathlib import Path
5
  from typing import Optional, Tuple
6
  import gradio as gr
7
+ import spaces
8
  from gradio_huggingfacehub_search import HuggingfaceHubSearch
9
  import huggingface_hub
10
  from sentence_transformers import CrossEncoder, SentenceTransformer, SparseEncoder
 
151
  )
152
 
153
 
154
+ @spaces.GPU(duration=180)
155
  def export_to_onnx(
156
  model_id: str,
157
  archetype: Archetype,
 
289
  )
290
 
291
 
292
+ @spaces.GPU(duration=180)
293
  def export_to_onnx_dynamic_quantization(
294
  model_id: str,
295
  archetype: Archetype,
 
423
  )
424
 
425
 
426
+ @spaces.GPU(duration=180)
427
  def export_to_onnx_optimization(
428
  model_id: str,
429
  archetype: Archetype,
 
534
  )
535
 
536
 
537
+ @spaces.GPU(duration=180)
538
  def export_to_openvino(
539
  model_id: str,
540
  archetype: Archetype,
 
670
  )
671
 
672
 
673
+ @spaces.GPU(duration=300)
674
  def export_to_openvino_static_quantization(
675
  model_id: str,
676
  archetype: Archetype,
requirements.txt CHANGED
@@ -1,3 +1,4 @@
 
1
  sentence_transformers[onnx-gpu,openvino]==5.1.0
2
  onnx==1.16.1
3
  https://huggingface.co/spaces/CISCai/chat-template-editor/resolve/08c8e90c53677ae70c66b3d90bf4e63a173b5505/gradio_huggingfacehub_search-0.0.8-py3-none-any.whl
 
1
+ spaces==0.50.2
2
  sentence_transformers[onnx-gpu,openvino]==5.1.0
3
  onnx==1.16.1
4
  https://huggingface.co/spaces/CISCai/chat-template-editor/resolve/08c8e90c53677ae70c66b3d90bf4e63a173b5505/gradio_huggingfacehub_search-0.0.8-py3-none-any.whl