Spaces:
Runtime error
Runtime error
done
Browse files- app.py +60 -0
- nnf_text_to_speech_v1_tester1.code-workspace +11 -11
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from gradio_client import Client
|
3 |
+
|
4 |
+
|
5 |
+
DEBUG_MODE = True
|
6 |
+
|
7 |
+
MESAGE_HEADER = """
|
8 |
+
# ππ©π»βπ» API Demo (Client component) ππ©π»βπ»
|
9 |
+
|
10 |
+
|
11 |
+
Welcome to my simple demonstration of the gradio potential as an API.
|
12 |
+
|
13 |
+
It is made of 2 components: *API_demo_server* and *API_demo_client*.
|
14 |
+
|
15 |
+
* Server component: ππ [Nuno-Tome/API_demo_server](Nuno-Tome/aPI_demo_server)
|
16 |
+
|
17 |
+
* Client component: ππ©π»βπ» [Nuno-Tome/API_demo_client](Nuno-Tome/aPI_demo_client)
|
18 |
+
|
19 |
+
**Just write you message and watch it be returned by the server.**
|
20 |
+
|
21 |
+
"""
|
22 |
+
|
23 |
+
|
24 |
+
def get_bmc_markdown():
|
25 |
+
bmc_link = "https://www.buymeacoffee.com/nuno.tome"
|
26 |
+
image_url = "https://helloimjessa.files.wordpress.com/2021/06/bmc-button.png" # Image URL
|
27 |
+
image_size = "150" # Image size
|
28 |
+
image_url_full = image_url + "?w=" + image_size
|
29 |
+
image_link_markdown = f"[![Buy Me a Coffee]({image_url_full})]({bmc_link})"
|
30 |
+
full_text = """
|
31 |
+
### If you like this project, please consider liking it or buying me a coffee. It will help me to keep working on this and other projects. Thank you!
|
32 |
+
# """ + image_link_markdown
|
33 |
+
return full_text
|
34 |
+
|
35 |
+
|
36 |
+
def send_request(text):
|
37 |
+
client = Client("Nuno-Tome/API_demo_server")
|
38 |
+
result = client.predict(
|
39 |
+
text,
|
40 |
+
api_name="/predict"
|
41 |
+
)
|
42 |
+
return result
|
43 |
+
|
44 |
+
with gr.Blocks() as demo:
|
45 |
+
|
46 |
+
gr.Markdown(MESAGE_HEADER)
|
47 |
+
gr.DuplicateButton()
|
48 |
+
gr.Markdown(get_bmc_markdown())
|
49 |
+
|
50 |
+
with gr.Row():
|
51 |
+
with gr.Column():
|
52 |
+
gr.Markdown("**Type your message:**")
|
53 |
+
inp = gr.TextArea(placeholder="What is your name?")
|
54 |
+
with gr.Column():
|
55 |
+
gr.Markdown("**This is your gradio api request response:**")
|
56 |
+
out = gr.JSON()
|
57 |
+
btn = gr.Button("Send request to server")
|
58 |
+
btn.click(fn=send_request, inputs=inp, outputs=out)
|
59 |
+
|
60 |
+
demo.launch(share=True)
|
nnf_text_to_speech_v1_tester1.code-workspace
CHANGED
@@ -6,24 +6,24 @@
|
|
6 |
],
|
7 |
"settings": {
|
8 |
"workbench.colorCustomizations": {
|
9 |
-
"activityBar.activeBackground": "#
|
10 |
-
"activityBar.background": "#
|
11 |
"activityBar.foreground": "#15202b",
|
12 |
"activityBar.inactiveForeground": "#15202b99",
|
13 |
-
"activityBarBadge.background": "#
|
14 |
-
"activityBarBadge.foreground": "#
|
15 |
"commandCenter.border": "#15202b99",
|
16 |
-
"sash.hoverBorder": "#
|
17 |
-
"statusBar.background": "#
|
18 |
"statusBar.foreground": "#15202b",
|
19 |
-
"statusBarItem.hoverBackground": "#
|
20 |
-
"statusBarItem.remoteBackground": "#
|
21 |
"statusBarItem.remoteForeground": "#15202b",
|
22 |
-
"titleBar.activeBackground": "#
|
23 |
"titleBar.activeForeground": "#15202b",
|
24 |
-
"titleBar.inactiveBackground": "#
|
25 |
"titleBar.inactiveForeground": "#15202b99"
|
26 |
},
|
27 |
-
"peacock.color": "#
|
28 |
}
|
29 |
}
|
|
|
6 |
],
|
7 |
"settings": {
|
8 |
"workbench.colorCustomizations": {
|
9 |
+
"activityBar.activeBackground": "#f7f7f6",
|
10 |
+
"activityBar.background": "#f7f7f6",
|
11 |
"activityBar.foreground": "#15202b",
|
12 |
"activityBar.inactiveForeground": "#15202b99",
|
13 |
+
"activityBarBadge.background": "#40bfbf",
|
14 |
+
"activityBarBadge.foreground": "#15202b",
|
15 |
"commandCenter.border": "#15202b99",
|
16 |
+
"sash.hoverBorder": "#f7f7f6",
|
17 |
+
"statusBar.background": "#e0dfda",
|
18 |
"statusBar.foreground": "#15202b",
|
19 |
+
"statusBarItem.hoverBackground": "#c9c7be",
|
20 |
+
"statusBarItem.remoteBackground": "#e0dfda",
|
21 |
"statusBarItem.remoteForeground": "#15202b",
|
22 |
+
"titleBar.activeBackground": "#e0dfda",
|
23 |
"titleBar.activeForeground": "#15202b",
|
24 |
+
"titleBar.inactiveBackground": "#e0dfda99",
|
25 |
"titleBar.inactiveForeground": "#15202b99"
|
26 |
},
|
27 |
+
"peacock.color": "#e0dfda"
|
28 |
}
|
29 |
}
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
gradio_client
|
2 |
+
gradio
|