lalalic commited on
Commit
1553b91
·
verified ·
1 Parent(s): ef74a91

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -7
main.py CHANGED
@@ -41,15 +41,13 @@ def run_task_model():
41
  pipe=pipeline(task, model=f'{user}/{model}', **kargs)
42
  return pipe(input)
43
 
44
-
 
45
  @app.route("/search")
46
  def search():
47
- response = requests.get(
48
- "https://huggingface.co/api/models",
49
- params={"limit":20,"full":"True","config":"True", "search": request.args.get("search")},
50
- headers={"Authorization":f"Bearer {os.environ.get("token")}"}
51
- )
52
- return response
53
 
54
  @app.route("/task_list")
55
  def tasks():
 
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")
47
  def search():
48
+ args=request.args.to_dict()
49
+ models = api.list_models(**args)
50
+ return models
 
 
 
51
 
52
  @app.route("/task_list")
53
  def tasks():