lalalic commited on
Commit
13b24be
1 Parent(s): 5e1960c

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +19 -21
main.py CHANGED
@@ -21,26 +21,6 @@ def parse_params():
21
  kargs={}
22
  return input, kargs
23
 
24
-
25
-
26
- @app.route("/<task>")
27
- def run_task(task):
28
- (input, kargs)=parse_params()
29
- pipe=pipeline(task, **kargs)
30
- return pipe(input)
31
-
32
- @app.route("/<user>/<model>")
33
- def run_model():
34
- (input, kargs)=parse_params()
35
- pipe=pipeline(model=f'{user}/{model}', **kargs)
36
- return pipe(input)
37
-
38
- @app.route("/<task>/<user>/<model>")
39
- def run_task_model():
40
- (input, kargs)=parse_params()
41
- pipe=pipeline(task, model=f'{user}/{model}', **kargs)
42
- return pipe(input)
43
-
44
  from huggingface_hub import HfApi
45
  api=HfApi()
46
  @app.route("/search")
@@ -83,5 +63,23 @@ def tasks():
83
  zero-shot-audio-classification
84
  zero-shot-object-detection'''.split("\n")
85
  ]
86
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  logging.info("xtts is ready")
 
21
  kargs={}
22
  return input, kargs
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  from huggingface_hub import HfApi
25
  api=HfApi()
26
  @app.route("/search")
 
63
  zero-shot-audio-classification
64
  zero-shot-object-detection'''.split("\n")
65
  ]
66
+
67
+ @app.route("/<task>")
68
+ def run_task(task):
69
+ (input, kargs)=parse_params()
70
+ pipe=pipeline(task, **kargs)
71
+ return pipe(input)
72
+
73
+ @app.route("/<user>/<model>")
74
+ def run_model():
75
+ (input, kargs)=parse_params()
76
+ pipe=pipeline(model=f'{user}/{model}', **kargs)
77
+ return pipe(input)
78
+
79
+ @app.route("/<task>/<user>/<model>")
80
+ def run_task_model():
81
+ (input, kargs)=parse_params()
82
+ pipe=pipeline(task, model=f'{user}/{model}', **kargs)
83
+ return pipe(input)
84
+
85
  logging.info("xtts is ready")