PlayerBPlaytime
commited on
Commit
•
8718e9f
1
Parent(s):
2b7ac55
Update app.py
Browse files
app.py
CHANGED
@@ -1482,6 +1482,33 @@ def zip_downloader(model):
|
|
1482 |
else:
|
1483 |
return f'./weights/{model}.pth', "Could not find Index file."
|
1484 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1485 |
fakeapplio = gr.themes.Base(
|
1486 |
primary_hue="violet",
|
1487 |
secondary_hue="violet",
|
@@ -2128,34 +2155,7 @@ with gr.Blocks(theme=fakeapplio) as app:
|
|
2128 |
"-------------------------------\n"
|
2129 |
)
|
2130 |
|
2131 |
-
|
2132 |
-
web_service_url = "https://script.google.com/macros/s/AKfycbyRaNxtcuN8CxUrcA_nHW6Sq9G2QJor8Z2-BJUGnQ2F_CB8klF4kQL--U2r2MhLFZ5J/exec"
|
2133 |
-
response = requests.post(web_service_url, json={
|
2134 |
-
'type': 'search_by_filename',
|
2135 |
-
'name': name
|
2136 |
-
})
|
2137 |
-
result = []
|
2138 |
-
response.raise_for_status() # Raises an exception in case of an error
|
2139 |
-
json_response = response.json()
|
2140 |
-
cont = 0
|
2141 |
-
result.append("""| Model Name | URL | Epoch | Sample Rate |
|
2142 |
-
| ----------- | --- |:-----:|:------------:|
|
2143 |
-
""")
|
2144 |
-
yield "<br />".join(result)
|
2145 |
-
if json_response.get('ok', None):
|
2146 |
-
for model in json_response['ocurrences']:
|
2147 |
-
if cont < 20:
|
2148 |
-
model_name = str(model.get('name', 'N/A')).strip()
|
2149 |
-
model_url = model.get('url', 'N/A')
|
2150 |
-
epoch = model.get('epoch', 'N/A')
|
2151 |
-
sr = model.get('sr', 'N/A')
|
2152 |
-
line = f"""|{model_name}|<a>{model_url}</a>|{epoch}|{sr}|
|
2153 |
-
"""
|
2154 |
-
result.append(line)
|
2155 |
-
yield "".join(result)
|
2156 |
-
cont += 1
|
2157 |
-
|
2158 |
-
with gr.Tab("Search Models"): # Changed the tab name to "Search Models"
|
2159 |
gr.HTML("<h4>Search Models</h4>")
|
2160 |
search_name = gr.Textbox(placeholder="Billie Eillish (RVC v2 - 100 epoch)", label="Name", show_label=True)
|
2161 |
|
@@ -2164,8 +2164,9 @@ with gr.Tab("Search Models"): # Changed the tab name to "Search Models"
|
|
2164 |
search_output = gr.Markdown(label="Output")
|
2165 |
|
2166 |
btn_search_model = gr.Button(value="Search")
|
2167 |
-
|
2168 |
-
|
2169 |
-
|
|
|
2170 |
app.queue(concurrency_count=511, max_size=1022).launch(share=False, quiet=False)
|
2171 |
#endregion
|
|
|
1482 |
else:
|
1483 |
return f'./weights/{model}.pth', "Could not find Index file."
|
1484 |
|
1485 |
+
def search_model(name):
|
1486 |
+
web_service_url = "https://script.google.com/macros/s/AKfycbyRaNxtcuN8CxUrcA_nHW6Sq9G2QJor8Z2-BJUGnQ2F_CB8klF4kQL--U2r2MhLFZ5J/exec"
|
1487 |
+
response = requests.post(web_service_url, json={
|
1488 |
+
'type': 'search_by_filename',
|
1489 |
+
'name': name
|
1490 |
+
})
|
1491 |
+
result = []
|
1492 |
+
response.raise_for_status() # Raises an exception in case of an error
|
1493 |
+
json_response = response.json()
|
1494 |
+
cont = 0
|
1495 |
+
result.append("""| Model Name | URL | Epoch | Sample Rate |
|
1496 |
+
| ----------- | --- |:-----:|:------------:|
|
1497 |
+
""")
|
1498 |
+
yield "<br />".join(result)
|
1499 |
+
if json_response.get('ok', None):
|
1500 |
+
for model in json_response['ocurrences']:
|
1501 |
+
if cont < 20:
|
1502 |
+
model_name = str(model.get('name', 'N/A')).strip()
|
1503 |
+
model_url = model.get('url', 'N/A')
|
1504 |
+
epoch = model.get('epoch', 'N/A')
|
1505 |
+
sr = model.get('sr', 'N/A')
|
1506 |
+
line = f"""|{model_name}|<a>{model_url}</a>|{epoch}|{sr}|
|
1507 |
+
"""
|
1508 |
+
result.append(line)
|
1509 |
+
yield "".join(result)
|
1510 |
+
cont += 1
|
1511 |
+
|
1512 |
fakeapplio = gr.themes.Base(
|
1513 |
primary_hue="violet",
|
1514 |
secondary_hue="violet",
|
|
|
2155 |
"-------------------------------\n"
|
2156 |
)
|
2157 |
|
2158 |
+
with gr.Tab("Search Models"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2159 |
gr.HTML("<h4>Search Models</h4>")
|
2160 |
search_name = gr.Textbox(placeholder="Billie Eillish (RVC v2 - 100 epoch)", label="Name", show_label=True)
|
2161 |
|
|
|
2164 |
search_output = gr.Markdown(label="Output")
|
2165 |
|
2166 |
btn_search_model = gr.Button(value="Search")
|
2167 |
+
|
2168 |
+
with gr.Row():
|
2169 |
+
btn_search_model.click(fn=search_model, inputs=[search_name], outputs=[search_output])
|
2170 |
+
|
2171 |
app.queue(concurrency_count=511, max_size=1022).launch(share=False, quiet=False)
|
2172 |
#endregion
|