kadirnar commited on
Commit
36961e5
1 Parent(s): 7e48556

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -4
app.py CHANGED
@@ -3,7 +3,28 @@ from tuneavideo.models.unet import UNet3DConditionModel
3
  from tuneavideo.util import save_videos_grid
4
  import torch
5
  import gradio as gr
 
 
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  def tune_video_predict(
9
  pipe_id: str,
@@ -24,10 +45,7 @@ def tune_video_predict(
24
  demo_inputs = [
25
  gr.inputs.Dropdown(
26
  label="Model",
27
- choices=[
28
- "Tune-A-Video-library/a-man-is-surfing",
29
- "sd-dreambooth-library/mr-potato-head",
30
- ]
31
  ),
32
  gr.inputs.Textbox(
33
  label="Prompt",
 
3
  from tuneavideo.util import save_videos_grid
4
  import torch
5
  import gradio as gr
6
+ from bs4 import BeautifulSoup
7
+ import requests
8
 
9
+ def model_url_list():
10
+ url_list = []
11
+ for i in range(1, 9):
12
+ url_list.append(f"https://huggingface.co/models?p={i}&sort=downloads&search=dreambooth")
13
+ return url_list
14
+
15
+
16
+ def data_scraping(url_list):
17
+ model_list = []
18
+ for url in url_list:
19
+ response = requests.get(url)
20
+ soup = BeautifulSoup(response.text, "html.parser")
21
+ div_class = 'grid gap-5 grid-cols-1 2xl:grid-cols-2'
22
+ div = soup.find('div', {'class': div_class})
23
+ for a in div.find_all('a', href=True):
24
+ model_list.append(a['href'])
25
+ return model_list
26
+
27
+ model_list = data_scraping(model_url_list())
28
 
29
  def tune_video_predict(
30
  pipe_id: str,
 
45
  demo_inputs = [
46
  gr.inputs.Dropdown(
47
  label="Model",
48
+ choices=model_list
 
 
 
49
  ),
50
  gr.inputs.Textbox(
51
  label="Prompt",