PlayerBPlaytime
commited on
Commit
•
2b7ac55
1
Parent(s):
638733f
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ from time import sleep
|
|
6 |
from subprocess import Popen
|
7 |
import faiss
|
8 |
from random import shuffle
|
|
|
9 |
import json, datetime, requests
|
10 |
from gtts import gTTS
|
11 |
now_dir = os.getcwd()
|
@@ -2126,6 +2127,45 @@ with gr.Blocks(theme=fakeapplio) as app:
|
|
2126 |
"Wondering how to train a voice? Join AI HUB Discord Server! https://discord.gg/aihub\n"
|
2127 |
"-------------------------------\n"
|
2128 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2129 |
|
2130 |
app.queue(concurrency_count=511, max_size=1022).launch(share=False, quiet=False)
|
2131 |
#endregion
|
|
|
6 |
from subprocess import Popen
|
7 |
import faiss
|
8 |
from random import shuffle
|
9 |
+
import requests
|
10 |
import json, datetime, requests
|
11 |
from gtts import gTTS
|
12 |
now_dir = os.getcwd()
|
|
|
2127 |
"Wondering how to train a voice? Join AI HUB Discord Server! https://discord.gg/aihub\n"
|
2128 |
"-------------------------------\n"
|
2129 |
)
|
2130 |
+
|
2131 |
+
def search_model(name):
|
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 |
+
|
2162 |
+
# Output
|
2163 |
+
with gr.Row():
|
2164 |
+
search_output = gr.Markdown(label="Output")
|
2165 |
+
|
2166 |
+
btn_search_model = gr.Button(value="Search")
|
2167 |
+
btn_search_model.click(fn=search_model, inputs=[search_name], outputs=[search_output])
|
2168 |
+
|
2169 |
|
2170 |
app.queue(concurrency_count=511, max_size=1022).launch(share=False, quiet=False)
|
2171 |
#endregion
|